I have a piece of software that transmits data over a UDP connection. However in our system we can transmit data only over a serial port. I was thinking of making a bridge between a UDP and serial using socat
. However I'm not familiar with it very well. Tried going over a few tutorials but they were not helpful. Also tried reading the manual, but it wasn't helpful as well.
I found an example here, and adapted it to my needs. Here is what I have on my embedded system (it has a static IP)
$ socat -v udp4-datagram:172.24.176.207:54321 \
open:/dev/ttyS0,raw,nonblock,waitlock=/tmp/s0.locak,echo=0,b115200,crnl
and here is what I have on my host machine (has a static IP as well)
$ socat -v udp4-datagram:172.24.176.116:54321 \
open:/dev/ttyUSB0,raw,nonblock,waitlock=/tmp/s0.locak,echo=0,b115200,crnl
You would have to excuse me, but I'm illiterate in socat
and networking
in general.
Several comments and questions.
- What does
open:/dev/ttyUSB0,raw,nonblock,waitlock=/tmp/s0.locak,echo=0,b115200,crnl
mean? Where would I find description of it? I understand/dev/ttyUSB0
andb115200
, but what is the rest? On an embedded system (172.24.176.207) I ran a
netcat
server:$ nc -ul 172.24.176.207 54321
and on the host machine I sent a UDP packet:
$ echo -n "hello" | nc -4u -w1 172.24.176.207 54321
but nothing happened. What am I missing?