Socket freezing? (Ethernet Server)

Hi,

my arduino ethernet server seems to fail in socket handling a few minutes after a client has connected to it.

The first few minutes, everything is just fine.

After that, it does not receive any data anymore (client.available() is always 0). And client.connected() always returns 1 forevermore, even if i power off the client.

So I assume, that for some reasons, the connection is lost but the arduino does not realize it. Any ideas, what could be causing this and how I could solve it?

Is this a known issue?

Are there any ways to get more detailed socket information with the ethernet shield?

Thank you

You can add this function and call it when you want to check the socket status.

#include <utility/w5100.h>

byte socketStat[MAX_SOCK_NUM];

void ShowSockStatus()
{
  for (int i = 0; i < MAX_SOCK_NUM; i++) {
    Serial.print(F("Socket#"));
    Serial.print(i);
    uint8_t s = W5100.readSnSR(i);
    socketStat[i] = s;
    Serial.print(F(":0x"));
    Serial.print(s,16);
    Serial.print(F(" "));
    Serial.print(W5100.readSnPORT(i));
    Serial.print(F(" D:"));
    uint8_t dip[4];
    W5100.readSnDIPR(i, dip);
    for (int j=0; j<4; j++) {
      Serial.print(dip[j],10);
      if (j<3) Serial.print(".");
    }
    Serial.print(F("("));
    Serial.print(W5100.readSnDPORT(i));
    Serial.println(F(")"));
  }
}

I have this code in a server in the playground, along with code to free up the sockets if they get frozen.
http://playground.arduino.cc/Code/WebServerST

Thanks!

Will this work with the ethernet shield also?

It was written for the ethernet shield.