Serial Port Multiplexing (2 apps to 1 port)

Onslo Onslo <onslo@nildram.co.uk>
Thu, 7 Oct 2004 08:22:47 +0100


Hello list :)

For some time now I have been trying to find some way of implementing
a method that will allow 2 (or more) serial communication applications
to read and write to 1 physical serial port, and I have failed at
every attempt. Hopefully someone can help me in my quest for a
solution.

A solution to do exactly this under Windows is available :
http://www.taltech.com/products/tcpcom.html

** quote **
5. Use TCP-Com to feed data from one physical RS232 port to multiple
RS232 serial communications programs.
Normally Windows will not allow two serial communications programs to
open the same serial port at the same time however it is possible to
use TCP-Com to feed data from a physical RS232 serial port to multiple
"Virtual" serial ports so that more than one application program can
input data from a single RS232 serial port.
To accomplish the above, configure one instance of TCP-Com to open a
physical serial port (COM1) on your PC and acting as a TCP/IP server
using any port number that you like. Next, open a second instance of
TCP-Com (select New from the TCP-Com File menu) and configure it to
create a virtual COM port (COM2) and have it connect as a TCP/IP
client to the TCP/IP port that the first (server) instance has been
configured to use. Finally, open a third instance of TCP-Com and
configure it to create another virtual COM port (COM3) and have it
also connect as a TCP/IP client to the TCP/IP port that the first
(server) instance has been configured to use. After you activate all
three instances of TCP-Com, your computer will behave as if it had two
additional COM ports COM2 and COM3. At this point, you can run two
serial communications programs – one on COM2 and the second on COM3
and both will be able to send and receive data in or out COM1. The
arrangement described above will work for as many virtual COM ports
that you wish to create so you can connect up to 98 separate serial
communications programs to the same physical serial port.
** end quote **

I would like to be able to do the exact same thing using Debian Linux.

I have tried using a combination of ser2net
(http://ser2net.sourceforge.net) and netcat (nc ser2net.host
ser2net_ttyS0_port <> /dev/ptyp0) and minicom to talk to the slave end
of the pseudo terminal pair. However, it would appear that ser2net
does not support concurrent connections to the same serial port, as is
the norm with serial I/O architecture.

Does anyone know of a method of allowing the same function on Linux as
quoted by the TCP-Com application for Windows?

Kind regards

Onslo