Good deal! Here is the timeout code for that.
int timeoutCount = 0;
while(client.connected()) {
while(client.available()) {
timeoutCount = 0;
Serial.write(client.read());
}
timeoutCount++;
if(timeoutCount > 10000) {
client.stop();
Serial.println("timeout");
}
delay(1);
}
client.stop();
This will prevent the w5100 from locking up if there is a connection break. It will close the connection if no packets received for 10 seconds.
edit: If you plan on using dhcp for the ip, you should call Ethernet.maintain() about once an hour to keep the ip lease active. I highly recommend using a static ip in the shield for long term connections. That way the router can power cycle and not affect the shield ip.