Ethernet Shield with Mega 2560 data feed drop out problems

Hello,

I am using a Mega 2560 with an Ethernet shield to monitor temperature and humidity from a DHT11 sensor. I have set up an account on Cosm and everything works well for 5 to 10 minutes and then the connection seems to drop out. If I press the reset button on the Ethernet shield the feed starts again for another 5 to 10 minutes before dropping out again. Is this a common problem and if so how can I fix it to recieve data continuously and reliably?

Thanks in advance.

If your code does not have all the error checking functions, it is a very common problem. You need to insure the w5100 socket rx buffer is empty and the server has closed its end (or timed out) before closing the connection. This code has all that:
http://playground.arduino.cc/Code/WebClient
The timeout code is very important. Without it, your connection will eventually lock up the Arduino if the server or connection fails. That happens a lot more often than you think.

Thanks SurferTim I will check it out.