SocatOptions (2017-05-25 19:10:42)

Useful socat options and recipies (to connect to device remotely, possibly behind restrictive firewall)

Traditional way to make a serial relay that TCP LISTENS on port 9001 is via ser2net :

echo '9001:raw:600:/dev/ttyUSB0:19200 8DATABITS NONE 1STOPBIT'>>/etc/ser2net.conf

See OverTCPWireless


ser2net is very useful when connecting over LAN (or via WAN when one has firewall administration passwd and knowledge ).

However, very often people do NOT have firewall administration passwd => they cannot connect to their devices over WAN.

In that case the devices can be set up to CONNECT to some relay (similar to a "turn server") that listens on some known public address.

Since socat can open the serial device (without ser2net), perhaps ser2net is not needed AT ALL. Socat might be just enough on orangepi/raspi

[socat example]

Socat

So an example of running socat to tcp-connect (not listen!):

while true; do socat pty,link=/dev/ttyS0 tcp:svn.x-dsl.hu:8809,mss=1444,forever,interval=10,fork ; done

Point your VemsTune to svn.x-dsl.hu:8808 and it will connect to the serial port opened by socat if all goes well