Ser2Net - in reverse.

I need a Raspberry pi to automatically telnet to a remote server (port 8000) and connect the Raspberry's serial port to the resulting data stream.
My ser2net.conf file is

8000:raw:0:/dev/serial0:115200 8DATABITS NONE 1STOPBIT

But of course, this doesn't "call" the server. So, if I type

telnet 8000

I get the data on the screen. But nothing out the serial port.

How do I get the Raspberry to automatically connect to a telnet server, and put all the data on the serial line? I could make the serial port the 'console port' but there are several reasons I don't want to do that . Also, I want to be able to check for that telnet data - and if it should ever stop for more than 10 seconds, I would like it to automatically restart.
  • Like
Reactions: Rob

I would think someone should know the answer, since one of these plus a Raspberry telnet server running ser2net would be equivalent to an unlimited-length serial cable. Of course, it would be unencrypted, but for some uses, it doesn't matter.


Super Moderator
Staff member
Gold Supporter
G'day Charles and welcome to :)

I don't know either, but @Rob I am wondering whether Charles' interests are served better here or at Single Board Computers, where Pi questions are often answered. We have a number of up and coming Pi enthusiasts, you or I could move this Thread.

At your discretion, and good luck, Charles :)

Chris Turner
Thanks, I will check out Single Board Computers. In the meantime, I did find some links to a telnet program written in Python that I believe I can modify to work - assuming that the overhead of Python isn't too great. My processor has other things to do at the same time.
I modified the Python file. And it works - kind of. The program sends/receives data, however it is too slow - that is, it seems to grab a byte, and send a byte. I was hoping that it would grab a packet and send a packet. The data is in variable-length packets (9-64 bytes). I think there is one thing I could key on - every packet begins with 0xFE. But does anyone have any ideas on how I can improve this?


Members online