A real Arduino Telnet server?

  • 2014/03/16 Update: The source code to this is now on GitHub. Check the Arduino link at the top of each page of this site.
This sketch tries to process Telnet protocol mesages.

This sketch tries to process Telnet protocol mesages.

The example code for the Ethernet library has some things that try to act like Telnet servers, but really all they do is open up a port and listen for data. When someone connects with a Telnet client, that client will send Telnet protocol messages trying to negotiate the connection. The Arduino examples I have found posted around do not deal with this, which means whatever “garbage” comes in could have unexpected results if the program isn’t properly ignoring invalid data.

Tonight, I began working on a more complete Telnet server for the Arduino. I am sure many of them exist, but what better way to learn than to reinvent the wheel?

I am doing a “fuller” version that would support many of the Telnet protocol options, then a dumber one that would just get rid of the protocol from the stream and ignore pretty much everything.

And, I will wrap that with a simple to use bit of code for making connections without all the tedious setup.

Comment if this project is of interest, as I have several others I may work on first.

4 thoughts on “A real Arduino Telnet server?

  1. Juergen

    I’m VERY interested in a Telnet client that can distinguish the different connections. For me it is mostly for security reasons: If I make an aquarium controller with a Telnet interface, I would not be very pleased if someone else can change the lighting times or set the clock to different time. So even if I create a password protection, after entering the password anybody else on port 23 can control the interface, because Arduino cannot distinguish different incoming connections. If you have an solution for a real Telnet server, please let us know about it!

    1. Allen Huffman Post author

      I had not even thought about that problem with the Arduino socket code. My modifications (shown in that example) will make it so the connection has to match the ports on both ends, which should eliminate that from being an issue.

      Give it a try — make those few mods, then compile up my telnet code (that lets you telnet end and just type fake commands until you disconnect) and see if you can connect with a second session.

  2. Pingback: Arduino as an irrigation control | Small World

Leave a Reply