socat bidirectional forwarding between UART and TCP (RPi)

645 Views Asked by At

Hey Guys i'm looking for some help with socat, it is very complicated to my beginner knowledge.

Some background, i have a device connect by uart (/dev/ttyS0) to my RPi and communication between them work great!

Now, i want the SAME information that is being received on ttyS0 to go via ethernet connection to a "transmitter / receiver" (one device), AND what ever information is received by the receiver to go into the RPi (via ethernet) and go through the uart (/dev/ttyS0) into the final component.

I have tried a few options with socat, but i can not seem to get the code of line to work.

i have the ip of the tx/rx and its port number, just asking how to implement them

code ive tried: sudo socat pty,link=/dev/ttyS0,raw tcp:192.168.19.240:23& and when i type it in, i notice that i lose connection on my serial to the original device "link 1 down"

im running: mavproxy.py --master=/dev/ttyS0 and once i run the above socat command in a different terminal, in the first terminal that i ran Mavproxy, i get the link 1 down.

with Mavproxy i have the option to add --out=udp:(IP):port, could i perhaps use this? and maybe socat in unidirectional back to uart?

thanks

0

There are 0 best solutions below