PPP Server on Windows
Asked Answered
P

3

12

We have a solution where some hardware connects to a COM port on a Win 7 machine, and interacts with our Java app. The hardware wants to use a PPP Server to transparently connect to an other server over TCP/IP.

Does anyone have a suggestion on how to do this? Start an OS native PPP Server from the Java app, with a connection to the COM port? How is this done?

Probe answered 10/8, 2011 at 13:17 Comment(3)
You can use javax.comm like communication api to access com ports from your Java app.Teenateenage
I'm missing something here, where is Java involved in the process?Malda
And the Java app must of course accept IP connections, I guess?Gerdy
P
13

You may be surprised to find that Win7 still supports PPP natively.

Follow these steps (or something like them) and you should be mostly good to go. I haven't actually performed a PPP connection since probably Win98, maybe Win2k, but the steps look to be pretty similar to what they were back them. It's not straightforward, but these should get you 80 or 90% of the way (the last 10-20% will be the normal hair-pulling irritations of getting the serial connection properly configured - there are way too many options involved in serial communications and PPP for it to go right on the first connection attempt).

  • Open Control Panel
  • Select "Phone and Modem". If it asks you about location, type in whatever information you need to make that dialog box happy (I think it just needs your area code, but maybe not, or maybe other stuff - it doesn't matter we won't be using it).
  • Tell it you want to install a modem, and don't worry that if can't find one - you'll be selecting one from a list.
  • Click the "Add" button, and tell it not to bother detecting one automatically
  • Under "(Standard Modem Types)" select the "Communications cable between two computers"
  • tell it what serial port to use

Now you need to set up the 'network adapter' for the PPP connection

  • go to the "Network and Sharing Center" of Control Panel
  • Click on "Set up a new connection or network"
  • Select "Set up a dial-up connection"
  • If it asks you about what modem to use, select the "Communications cable between two computers modem" that you just set up (this shouldn't happen unless you have an actual modem in your computer).
  • Give the "Create a Dial-up Connection" dialog box a bogus phone number so it will let you continue... And give it a connection name that you like instead of "Dial-up Connection"
  • Click "Connect" and it'll try to dial. Of course it'll fail. Click "Set up the connection anyway"

Now configure various PPP settings on the new network adapter:

  • Click on the "change adapter setting" link in the "Network and Sharing Center" control panel
  • Right click on the network adapter that you just created ("Dial-up Connection" or whatever name you gave it), and select "Properties"
  • Configure the "Communications cable between two computers" (mainly this lets you set the speed). Look through the other tabs for the various other options you might need to control. Don't forget to configure the TCP/IPv4 properties that you might need on the "Networking" tab. If you're using IPv6, make sure that stuff is configured too.

Once the hardware device establishes a PPP connection to the Win7 COM port, the Java application should be able to communicate over the PPP link as if it were a regular network adapter. Good Luck!

Publicness answered 16/8, 2011 at 21:27 Comment(1)
Does windows supports only PPP client side connection? How to create PPP server on windows? I mean pppd on windows - server which gives IP, DNS etc to client PPP side.Seychelles
A
1

This is a workaround using VirtualBox. I can't figure out how to run PPP server natively on Win7.

pppd - Ubuntu ttyS0 - VirtualBox Port 1 - Win7 COM1 -- RS232 -- target's ppp client

  1. Prepare VirtualBox 5 and Ubuntu 16 as a guest OS on Win7
  2. Go to the VirtualBox Settings -> Serial Ports -> Port 1
    • Check : Enable Serial Port
    • Port Number : COM1 IRQ : 4 I/O Port : 0x3F8
    • Port Mode : Host Device
    • Check : Connect to existing pipe/socket
    • Path/Address : COM1
  3. Open a Ubuntu terminal

    • sudo apt-config install ppp
    • sudo apt-get install ppp
    • sudo stty -F /dev/ttyS0 raw
    • sudo stty -F /dev/ttyS0 -a
    • sudo pppd /dev/ttyS0 115200 192.168.17.1:192.168.17.2 proxyarp local noauth nodetach dump nocrtscts passive persist maxfail 0 holdoff 1

    pppd options in effect:
    nodetach # (from command line)
    holdoff 1 # (from command line)
    persist # (from command line)
    maxfail 0 # (from command line)
    dump # (from command line)
    noauth # (from command line)
    /dev/ttyS0 # (from command line)
    115200 # (from command line)
    lock # (from /etc/ppp/options)
    nocrtscts # (from command line)
    local # (from command line)
    asyncmap 0 # (from /etc/ppp/options)
    passive # (from command line)
    lcp-echo-failure 4 # (from /etc/ppp/options)
    lcp-echo-interval 30 # (from /etc/ppp/options)
    hide-password # (from /etc/ppp/options)
    proxyarp # (from command line)
    192.168.17.1:192.168.17.2 # (from command line)
    noipx # (from /etc/ppp/options)
    Using interface ppp0
    Connect: ppp0 <--> /dev/ttyS0
    Cannot determine ethernet address for proxy ARP
    local IP address 192.168.17.1
    remote IP address 192.168.17.2

Alesiaalessandra answered 12/5, 2020 at 17:12 Comment(0)
R
0

Using Google on the basis of @hari comment about javax.comm I found a tutorial on TINI, which may be useful on your purposes: the guide takes a PPP connection through COM port with TINI library equally as you want to do.

Radioactive answered 16/8, 2011 at 20:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.