Go Down

Topic: Ethernet library and multiple client connections on the same port. (Read 973 times) previous topic - next topic

allenhuffman

Summary:

I made modifications to the Ethernet library to allow it to handle multiple incoming connections on the same port (like how multiple "telnets" work to a real server). Can I get someone to look at my changes and see if the fixes could be done correctly and integrated?

Long Version:

In early 2014, I ported an old BASIC TRS-80 BBS to the Arduino C as a silly experiment. I added support for Ethernet connections. When someone was connected to the BBS, any other attempts to telnet it would just hang. Since my BBS was not multi-user, I wanted to at least return a "Sorry, the system is in use. Try later." message to other telnet requests. I found this was not possible with the Ethernet library since it does not track the client connections properly.

I made a few minor changes to allow tracking the incoming client port and now I can run a telnet server that allows up to four incoming telnets to port 23. (In my case, I handle three active connections, and reserve the fourth for "System busy. Please try back later." messages.)

I documented my hacks here:

http://subethasoftware.com/2013/04/09/arduino-ethernet-and-multiple-socket-server-connections/

This article is the #1 most viewed article on my site, so there seems to be many encountering the same problem and looking for a solution. I just tested my changes with 1.6.0 and they still work.

I do not program C++, and some of my changes may not be in the proper place. I would like to know if someone could look at what I did and see if we could properly fix the Ethernet library. The Wiznet chip supports this, but the Arduino implementation does not.

Thanks... I have attached a .zip of my changes (I modified five files) with a readme.txt and an example program. The full article on my site shows the problem with examples.
Embedded Software Engineer
UNO | Leonardo | Due | Teensy | Raspberry Pi | BASIC Stamp | OS-9 RTOS
http://www.subethasoftware.com - Established in 1990.

Go Up