Webserver with problems

Stanleyvc

Active member
Hi All,

I have a program with a web server and Ajax, every now and then I get an error with "StateErr: -28"
and every now and then I get the message: "No data available, closing socket"
and then the program stops for a while to continue later.
I see that through a runled which blinks every 500mS.

When data is received by the web server, it jumps to the "webSpace" function.
I'm using the "NativeEthernet" library

Thank you very much.

Code Web Server:
Code:
void web() {
  String inp = "";

  // listen for incoming clients
  EthernetClient client = webServer.available();
  if (client) {
    if (webDebug == true) Serial.println("new client");
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        inp += (String)c;
        if (webDebug == true) Serial.write(c);
        if (c == '\n' && currentLineIsBlank) {
          webSpace(client,inp);
          break;
        }
        if (c == '\n') {          
          currentLineIsBlank = true;
        } else if (c != '\r') {          
          currentLineIsBlank = false;
        }
      }
    }    
    delay(1);    
    client.stop();
    if (webDebug == true) Serial.println("client disconnected");
  }
}

Knipsel.JPG


Thanks.
 
Back
Top