Connecting to a Remote Serial Port over TCP/IP

https://www.acmesystems.it/socat

This article illustrates how to realize a lan to serial gateway

Remote unit

On the remote unit install ser2net then add this line in /etc/ser2net.conf configuration file

2000:raw:600:/dev/ttyS1:115200 8DATABITS NONE 1STOPBIT

Launch ser2net:

# ser2net

Local unit

Install the socat utility.

Create a directory called $HOME/dev

Launch socat:

$ socat pty,link=$HOME/dev/ttyV0,waitslave tcp:remoteip:remoteport

Open minicom on /dev/ttyV0 and send chars to your remote port.

Examples

Serial port on stdin

socat /dev/ttyUSB0,b115200,raw,echo=0,crnl -

Remote console

Board

socat /dev/ttyS2,b115200,raw,echo=0 TCP:terzo.acmesystems.it:2002
socat /dev/ttyS4,b115200,raw,echo=0 TCP:terzo.acmesystems.it:2004

Server web

socat TCP-LISTEN:2002 PTY,link=ttyV2,raw,crnl
socat TCP-LISTEN:2004 PTY,link=ttyV2,raw,crnl

Links

 

Sergio Tanzilli 
System designer, software developer and company co-founder 
tanzilli@acmesystems.it 
Webpages: https://www.acmesystems.it and http://www.tanzolab.it 
Github repository: https://github.com/tanzilli and https://github.com/acmesystems
posted @ 2019-03-11 14:55  阿C  阅读(898)  评论(0编辑  收藏  举报