Whole document tree 2. The Server SideIt is assumed that the server is a Linux system with either:
The easiest setup I can think of uses a five lines perl script to implement a modem daemon in /usr/sbin/modemd:
The modem daemon is started by the inetd process if a client connects to the appropriate port as described below. The modemd simply connects the socket handle with STDIN and STDOUT of the cu command and lets cu handle the actual modem device. The existence of the modem daemon must be made known to the inetd process by updating its configuration file, usually /etc/inetd.conf like:
In order to make this work, an entry to /etc/services needs to be added like:
This associates a symbolic name with an explicit port, 2006 in the example. The portnumber could be any number not already assigned to an existing service. After these changes have been made, a signal must be sent to the inetd process in order to let inetd re-read and process its configuration file:
Now the server side is ready to accept requests from clients. The correct function can be verified by:
You are now connected to the modem. You can now issue AT commands in order to verify the setup:
Instead of using the Perl script as a modem server, there is also a program named Masqdialer available at http://w3.cpwright.com/mserver/. With Masqdialer you can export any number of modems connected to your server to any host that can connect the server via TCP/IP on a given port with a binary data stream. 2.1. Masqdialer InstallationBefore compiling check config.h for compile time options:
Do make all. Copy the binaries (mserver and tcpconn) into a suitable directory such as /usr/local/sbin/. Copy mserver.conf into the path that you specified in config.h. Masqdialer could be started from one of your system startup scripts. A simple /usr/local/sbin/mserver will run it as a daemon. 2.2. Masqdialer ConfigurationA line in mserver.conf could look like this:
which would mean that a modem connected to /dev/ttyS1 can be connected via port 5800 from anywhere in the domain foo.org and from host 192.168.2.1. Any other hosts are rejected. Pitfall: If you don't specify hosts then ANY host will be allowed to connect. The serial line settings are fixed and cannot be changed from the client side. You can export several modems on a single port. Masqdialer only locks the modem devices by use of UUCP style lock files when they are actually in use thus allowing other programs to take advantage of them. |