-->
Page 1 of 1

Stability of the Webclient

PostPosted: Sun Oct 04, 2015 7:31 am
by Janjansen47
Wonder whether the esp web client is really stable. Working from the examples is easy to have a client feeding a MySql database on a server (in my case on a Synology NAS). However it turned out not to be stable as sometimes communication between client en server stops. You can see this easy in the MySql database.

I made another set up:
    first esp acts as an access point and web server: This turns out to be stable up to now.
      Second and third esp's are configured as web clients running the same software but use another id.
      Each client informs the server about a change in it's counters together with it's id.
    Initially communication is as expected and robustness is okay ( switch off and off the server or clients does return communication to normal.

    HOWEVER: now and then one of the clients stops the communication with the web server. A test via the browser shows that the server cannot be blamed. Resetting the client affected returns communications to normal.

    When one clients fails the other continues his communication with the server. Nu issues discovered yet.

    Do we have similar experiences? ;)

    Re: Stability of the Webclient

    PostPosted: Fri Jul 13, 2018 2:24 pm
    by nm.vrouwe
    I have a sumilar (or the same) problem. An esp8266 running as a client requests data from a server. After about 730 requests the client stops.
    Tried several ESP versions, all have the same problem.
    Tried a different server, same problem.
    Tried ThingsPeak as server, same problem.

    I want to check the status of a sensor every second over my WiFi network. Als long as the client stops every 730 requests, i cannot proceed with this project.
    Help is appreciated.

    The loop-code is:

    void loop()
    {
    ledState = !ledState;
    digitalWrite(LEDPin, ledState); // ring a bell to signal that server is death
    Serial.print("Retrieve from TS. ");

    if (now() - lastCheck > 3)
    {
    if (!client.connected())
    {
    while (!client.connect(host, 1002)) // get some data back from TS
    {
    Serial.println("connection failed");
    delay(1000);
    client.stop();
    }
    }
    requestNumber++;

    client.print(String("GET /") + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n");
    client.flush();

    answerTimeout = millis() + 10000;
    Serial.print(" Request number: ");
    Serial.print(requestNumber);
    while (answerTimeout > millis())
    {
    i = 0L;
    while (client.available())
    {
    i++;
    char aChar = client.read();
    answerTimeout = millis() + 200;
    delay(1);
    }
    if (i > 0)
    {
    Serial.print(" Read characters: ");
    Serial.println(i);
    }
    delay(1);
    }
    client.stop();
    }
    };

    =============================================================================
    I learned that the client is loosing 56 bytes free space every call I make to it.
    When I went bach to the prevoius version of ESP8266WIFI, it works fine so fat. No more stops, no more memory losses