Ethernet Shield does not respond consistantly

Your code has no way to free frozen sockets. If you are exposed to the internet, port scanners can eat all your sockets. Some open a socket, but never send anything and don't close it. Take a look at my server code.
http://playground.arduino.cc/Code/WebServerST
At the bottom of the first example code are two functions that might interest you.
ShowSockStatus
and
checkSockStatus
The loop function shows how I use them.