Ethernet server() problem.

I am using an Ethernet shield for my Megabitmeter (megabitmeter.de). The code I use is basicly a copy from the Ethernet library example

This code works fine the first time I connect. I get the output 'Eerste' and 'Tweede' (first and second in Dutch). However, if I disconnect and reconnect I get no response at all.

It seems like the variable 'client' never returns to false after disconnection. What am I doing wrong?

The code I use is at http://paste.pocoo.org/show/314933/

It does not look to me like there is any way to break out of the while(client.connected()) loop. Once the client connects, it appears to stay connected, and stay in that loop.

Shouldn't client.connected() return FALSE as soon as I disconnect my TCP session with Arduino (and no more bytes are available)?

Should it? and Does it? are two different questions. Clearly the answer to "does it" is no.

Perhaps you need to add something to the TCP stream to tell the client that it can disconnect.

It clearly does not, so it seems there is a bug in the Ethernet lib? I cant tell the client to disconnect. The whole idea was that I can reconnect without trouble when my connection gets lost for some reason. I now have to reset arduino when this happends.

How is the Ethernet shield supposed to know that your client went away? If there is a bug, it is in your expectations.

If a client goes away the TCP session is reset and thus it knows that the client disconnected. If you feel this is by design please tell me what the function of connected() should be? It seems a useless function if it only works if I manually disconnect the TCP socket from the Arduino's side.

According to the docs:
Description

Whether or not the client is connected. Note that a client is considered connected if the connection has been closed but there is still unread data.

Returns

Returns true if the client is connected, false if not.

To me this seems like it should return FALSE when the client is disconnected (TCP session reset) and there are no more bytes to be read.

I don't think the problem is with the Ethernet library, more likely you are stuck in your while reset == false loop when you disconnect. Which means you will never check the connection again.