Reseting ethernet shield without reseting Arduino

This is part of the code I use to prevent lockups. The entire server example is here. It also includes a timeout feature if the client sends a few characters, but doesn't send a '\n' (newline) character. That will also cause a lockup (only takes once to lock up your sketch). Look at the second (old) server code at the bottom of the page for that timeout. The loopCount variable controls the timeout.
http://playground.arduino.cc/Code/WebServerST

Add the code below. Press 'r' in the serial monitor to view the status for all sockets. edit: If this fails to display the socket status, then you have a client that sent a few characters and no newline. See the timeout in the server code on the playground.

If you see a "Socket frozen" message on the serial monitor, that means the socket was opened by a client (connected), but didn't send anything for 30 seconds. If that happens 4 times, the server will stop responding permanently without the checkSockStatus() function.

#include <utility/w5100.h>
#include <utility/socket.h>

byte socketStat[MAX_SOCK_NUM];
unsigned long connectTime[MAX_SOCK_NUM];

void loop() {

  if(Serial.available()) {
    if(Serial.read() == 'r') ShowSockStatus();    
  }

  checkSockStatus();

  // rest of your loop code
}


// add these functions

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(")"));
  }
}

void checkSockStatus()
{
  unsigned long thisTime = millis();

  for (int i = 0; i < MAX_SOCK_NUM; i++) {
    uint8_t s = W5100.readSnSR(i);

    if((s == 0x17) || (s == 0x1C)) {
        if(thisTime - connectTime[i] > 30000UL) {
          Serial.print(F("\r\nSocket frozen: "));
          Serial.println(i);
          close(i);
        }
    }
    else connectTime[i] = thisTime;

    socketStat[i] = W5100.readSnSR(i);
  }
}

A status list:
0x0 = available
0x14 = waiting for a connection
0x17 = connected
0x1C = connected waiting for close
0x22 = UDP