[PLUG] sending data from single serial port to multiple readers

Galen Seitz galens at seitzassoc.com
Tue Sep 10 16:31:19 PDT 2013

On 09/09/13 23:08, Bill Barry wrote:
> Instead of the fork command you can use ncat that is part of the nmap
> distribution
> http://nmap.org/ncat/guide/ncat-usage.html
> As the page above says:
> "With --keep-open (or -k for short), the server receives everything
> sent by any of its clients, and anything the server sends is sent to
> all of them."
> which is exactly what is needed.

Good eye!  Thanks for spotting this!  I read over the ncat docs but I 
missed that.  I naively assumed that -k worked the same as socat.

> Combine that with  the socat command to send and receive data from the
> serial port
> and you get:
> ncat --listen --keep-open localhost 9212 --sh-exec "socat -
> /dev/ttyUSB0,raw,echo=0,crnl"

This didn't work for me.  The serial data out was not written to all 
client connections.  However, the following does seem to work.

stty -F /dev/ttyUSB0 cs8 -cstopb -parenb 57600 crtscts etc.
ncat --listen --keep-open localhost 9001 < /dev/ttyUSB0 > /dev/ttyUSB0

Thanks again for your help!

Galen Seitz
galens at seitzassoc.com

More information about the PLUG mailing list