0

I'm trying to test following envirorment:

One server (it's a router, It has busybox and few other cmd) with a a physical serial port and and open socket

#tcpsvd -v 0.0.0.0 -p 999 cat /dev/ttyS0

Several clients connecting to server

My issues: 1 when I write to ttyS0 a new line data Is random sent to only One client at time, i would this to be to all at same time. 2 what can I use instead of cat to have a bidirectional communication? 3 How can I have flow done byte by bye sent not line be line?

Thanks!

1 Answer 1

1

1 when I write to ttyS0 a new line data Is random sent to only One client at time, i would this to be to all at same time.

Unfortunately this is a standard feature of serial port communication: a TTY device is a simple FIFO. Once the data is read from the TTY device, it's gone. This is why having multiple processes accessing the same TTY device simultaneously is usually not a good idea.

A RS-232 serial line is fundamentally one-to-one: devices and protocols designed for serial ports are designed to expect just one link partner at the other end of the line.

If you need multiple TCP clients with a single serial port, I'm afraid you might have to make your own program that would do the communication the way you need it to happen.

2 what can I use instead of cat to have a bidirectional communication?

microcom is a busybox command that would seem to fit the purpose here. According to the busybox man page, it uses stdin & stdout, so it should work with tcpsvd... but I have not tested it.

3 How can I have flow done byte by bye sent not line be line?

Assuming I understood your question, stty -F /dev/ttyS0 raw should do it, but if you switch to microcom instead of cat, it should already do that for you.


I assumed you are restricted by whatever is available on the router, so the above answer assumes only busybox, as I cannot know what other commands might be available.

But if you can add more software, then I would recommend using something designed for the purpose, like ser2net.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.