May '13 13

Serial via Network Bridge

I had a requirement for a Serial Bridge, eg: serial->Network->serial, I found a nice page with some options,  socat to be good enough for what I needed.

Server (Listening Side connected to end device)

socat -v -d -d tcp-l:54321,reuseaddr,fork file:/dev/ttyS0,nonblock,raw,echo=0,waitlock=/tmp/ttyS0.lock

Client (connecting to server)

socat -v -d -d tcp:123.123.123.123:54321 file:/dev/ttyS0,nonblock,raw,echo=0,lockfile=/tmp/ttyS0.lock

Alternative using Virtual PTY and SSH remote exec

socat PTY,link=$HOME/dev/vmodem0,raw,echo=0,wait-slave EXEC:'"ssh modemserver.us.org socat - /dev/ttyS0,nonblock,raw,echo=0"'