-2

Most people want to telnet into a Raspberry pi and use the serial ports to connect to something else. They want the Raspberry to be the telnet server.

But I want the Raspberry pi to be a telnet CLIENT and automatically connect to a remote telnet server. Data that I placed on the Raspberry's serial port pins would be transferred to the remote server, and data from the remote server would appear on the Raspberry's TxD pin.

All the techniques I have seen (ser2net, socat, etc) assume that the Raspberry is the telnet server. Also, I need the system to automatically reconnect to the server as quickly as possible if the connection is broken.

  • 1
    If fact "Most people DO NOT want to telnet into a Raspberry pi" - the rest of us gave up on telnet in the 1970s. – Milliways Jun 13 at 2:54
  • Does something like socat /dev/ttyS0,raw,echo=0,crnl TCP4:www.domain.org:23 not work? – Roger Jones Jun 13 at 16:01
0

A little more info is probably needed to provide a better answer.

In your question, you wrote

Data that I placed on the Raspberry's serial port pins would be transferred to the remote server, and data from the remote server would appear on the Raspberry's TxD pin.

Transmit pins only ever transmit. Receive pins only ever receive. There is no reversing that functionality on any computer. In RS-232 serial, the 'transmit' pins of one computer are connected to the 'receive' pins of the remote computer ... and vice versa. I use the phrase remote computer colloquially because the pins were usually swapped between the computer & modem when dial-up modems were used and they were labeled 'Data Terminal Equipment' (DTE) and 'Data Communication Equipment' (DCE). Getting the data from the remote computer to appear on the RxD (receive data) pins is just a matter of proper wiring connections.

Telnet is depreciated because it does not encrypt traffic (username, password, and all other data are transferred in clear-text). telnet/telnetd has been replaced by more modern tools such as ssh/sshd.

Also telnet & ssh assume IP networking and aren't really designed for use over serial (although there are ways to make a serial connection look like a network -- but that's another topic).

A terminal client is typically used to establish a connection over serial ... using tools such as 'minicom' (historically there have been many such tools; tip was the basic program on most Unix servers but often times tools were needed to do file-transfers via protocols such as xmodem, ymodem, zmodem... etc.. I made heavy use of 'kermit' back in the day (now 'ckermit')). If you do need file transfer support then you need to have a program on both sides of the connection that support the same file transfer protocol (e.g. if you use kermit then you'll need a program that supports kermit on both the client and the server.)

While terminal clients are typically used for interactive sessions, they do support scripting to allow for things like automated batch file transfers, etc.

If this is what you want, then you may want to install 'minicom' (sudo apt-get install minicom) and then look at information on how to set up scripting to automate any batch transfers of data: Minicom send automate script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.