Limiting Ethernet to one inbound connection

SurferTim:
Oh no! That was not my point. My point was that most client-server communication is a one-time thing, repeated over and over. That is a result of the internet and web servers.

I use persistent connections, like for telnet, but to say that you have not heard of a http connection is also bizarre.

If you read a lot of my posts, you will find I am into experimentation. If I can help, I will.

Even with HTTP you have to have some context about your client, especially if you become I/O bound waiting for data. With the Arduino programming model you let the loop method fall out so that you can let the device process other jobs. This means that one call through loop gets you one byte of data from the client. If you don't have state about the client, then you lose context on where to send the data on the next loop iteration. All the HTTP Server examples for Arduino use busy loops to process everything at once and then send it all out at once. That model fails when you throw in asynchronous data access. But I digress.

My application I'm writing today is the equivalent of a telnet server. I have an end-point on ethernet and an endpoint on serial. Because of this I can only have one connection be presented from ethernet to serial at a time. Simply not responding to subsequent connection attempts isn't an option. Some feedback needs to be given so that the caller knows that the resource is available, but currently in use. As they are currently written, you cannot differentiate between the allowed connection and the disallowed connections incoming connections. I don't want to reinvent the wheel to accomplish this, but if I have to I will.