Official WiFi Shield server disconnects

I’ve been troubleshooting this for weeks and I keep coming back to the problem of the WiFi server disconnecting, causing the Arduino sketch to hang up. I’m using code adapted from the WiFiChatServer example. The whole thing will run fine for hours to days and then just stop. I started putting in Serial print statements checking the WiFi connection and the server status with each run of the loop. The WiFi remains connected and the server.status() call will return a 1 (Ok) for a period (few hours, up to 5 days); and then for reasons I can’t figure out, the server.status() call will return 0 and the whole program will stop soon afterward.

I tried instituting a server.begin() call after server.status() returns a 0, but that doesn’t get things going again.

Arduino WiFi Shield firmware version: 1.1.0
Arduino IDE version: 1.0.5 r2
Arduino Uno Rev3

Code attached…

I’ve googled around and checked forums and read that this may be a bug, but the conversation didn’t go anywhere or went beyond my experience level.

I appreciate your help and input.

Jason

aquaculture_wifi_debug2.ino (13.6 KB)

Don't know why this came to mind but I assume you have a WiFi router providing your internet connection.
For example my router leases an IP for a period of time, then it has to renew the lease.
Could the stoppages be coinciding with something like lease renewal by your router?

I assigned the Arduino with a static IP, which was set up by our network admin. So we don't think its a lease renewal by the DNS.

What is the last thing displayed on the serial monitor? Is it
"Data requested by PC"
or
"Data sent to PC"

Why all the delay() calls? You shouldn't need those. It is taking several seconds just to go through the loop.

edit: The wifi shield server firmware is not very reliable. It does have a tendency to crash and return corrupt or incorrect data.