Do the Ethernet and Wifi Shields ever work 24/7?

I'm about ready to give up. Using the sample Ethernet and Wifi server sketches from this site, I can get both shields to work ...... sort of.

The sketches work for up to 18 hours and for as little as 15 minutes before failing to respond to a browser request. Once in a great while I get the server to come back to life, but that's rare. I have an old Arduino Uno, a rev 3 Uno and a Mega. They all exhibit the same behavior.

Has anyone got a sample sketch for either shield that they believe lives forever (meaning more than 24 hours)?

I have a relatively bulletproof server sketch example for the ethernet shield. It will work with the wifi shield with only minor mods, but isn't as bulletproof due to the wifi firmware problems with server code.
http://playground.arduino.cc/Code/WebServerST

The wifi shield firmware tends to send incorrect or corrupted files if more than one client connects simultaneously. It also has a couple second delay every couple seconds during a download if the file is big.

Thank you. I'll give it a try and report back.

Some server meta refresh code test code for t5he 5100 ethernet card that I've let run for a couple of days with over 500k refreshes without a crash or hang.

// zoomkat's meta refresh data frame test page 5/25/13
// use http://192.168.1.102:84 in your brouser for main page
// http://192.168.1.102:84/data static data page
// http://192.168.1.102:84/datastart meta refresh data page
// for use with W5100 based ethernet shields
// set the refresh rate to 0 for fastest update
// use STOP for single data updates

#include <SPI.h>
#include <Ethernet.h>

const int analogInPin0 = A0;
const int analogInPin1 = A1;
const int analogInPin2 = A2;
const int analogInPin3 = A3;
const int analogInPin4 = A4;
const int analogInPin5 = A5;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // arduino ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port
unsigned long int x=0; //set refresh counter to 0
String readString; 

//////////////////////

void setup(){
  Serial.begin(9600);
    // disable SD SPI if memory card in the uSD slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();
  Serial.println("meta refresh data frame test 5/25/13"); // so I can keep track of what is loaded
}

void loop(){
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
         if (readString.length() < 100) {
          readString += c; 
         } 
        //check if HTTP request has ended
        if (c == '\n') {

          //check get atring received
          Serial.println(readString);

          //output HTML data header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          //generate data page
          if(readString.indexOf("data") >0) {  //checks for "data" page
            x=x+1; //page upload counter
            client.print("<HTML><HEAD>");
            //meta-refresh page every 1 seconds if "datastart" page
            if(readString.indexOf("datastart") >0) client.print("<meta http-equiv='refresh' content='1'>"); 
            //meta-refresh 0 for fast data
            if(readString.indexOf("datafast") >0) client.print("<meta http-equiv='refresh' content='0'>"); 
            client.print("<title>Zoomkat's meta-refresh test</title></head><BODY>
");
            client.print("page refresh number: ");
            client.print(x); //current refresh count
            client.print("

");
            
              //output the value of each analog input pin
            client.print("analog input0 is: ");
            client.print(analogRead(analogInPin0));
            
            client.print("
analog input1 is: ");
            client.print(analogRead(analogInPin1));
                        
            client.print("
analog input2 is: ");
            client.print(analogRead(analogInPin2));
            
            client.print("
analog input3 is: ");
            client.print(analogRead(analogInPin3));
                                    
            client.print("
analog input4 is: ");
            client.print(analogRead(analogInPin4));
            
            client.print("
analog input5 is: ");
            client.print(analogRead(analogInPin5));
            client.println("
</BODY></HTML>");
           }
          //generate main page with iframe
          else
          {
            client.print("<HTML><HEAD><TITLE>Zoomkat's frame refresh test</TITLE></HEAD>");
            client.print("Zoomkat's Arduino frame meta refresh test 5/25/13");
            client.print("

Arduino analog input data frame:
");
            client.print("&nbsp;&nbsp;<a href='/datastart' target='DataBox' title=''yy''>META-REFRESH</a>");
            client.print("&nbsp;&nbsp;&nbsp;&nbsp;<a href='/data' target='DataBox' title=''xx''>SINGLE-STOP</a>");
            client.print("&nbsp;&nbsp;&nbsp;&nbsp;<a href='/datafast' target='DataBox' title=''zz''>FAST-DATA</a>
");
            client.print("<iframe src='/data' width='350' height='250' name='DataBox'>");
            client.print("</iframe>
</HTML>");
          }
          delay(1);
          //stopping client
          client.stop();
          //clearing string for next read
          readString="";
        }
      }
    }
  }
}

My Ethermega based home automation system at http://www.2wg.co.nz has been running continuously for 24 days now. In order to get that robustness i had to do a lot of work to get my RAM memory usage working correctly and to solve a problem where the ethernet sockets got stuck and were lost to the application. Management of both of these issues manifest as web pages that you can check out.

My application has 8,000 lines of code - it is nothing trivial and is accessed constantly by the major search engine web crawlers.

The application has been running for 24 days because I have not done any new coding on it in that time. The system also runs on a UPS so was not impacted by a short term power cut last week.

if your system is not reliable you will have to debug it and resolve issues one by one. That can be a major and frustrating task. The forum is here to help.

Cheers

Catweazle NZ

It might be worth taking a look at your traffic with Wireshark. My ISP sends some over-sized packets periodically which my original wifi library choked on. The timing sounds familiar too. It needed a few minor tweaks to prevent the resulting buffer overrun/crash.