Help understanding WifiClient example ?

rlemaigre
Posts: 1
Joined: Sun Feb 14, 2021 1:44 pm

Help understanding WifiClient example ?

Postby rlemaigre » Sun Feb 14, 2021 2:19 pm

Hi,

I would like to understand the official WifiClient example located here : https://github.com/espressif/arduino-es ... Client.ino

Specifically this part :

Code: Select all

    // Read all the lines of the reply from server and print them to Serial
    while(client.available()) {
        String line = client.readStringUntil('\r');
        Serial.print(line);
    }
What if the network is really slow, causing a pause between the arrival of two successive lines ? Then it is my understanding client.available() would return 0 since the buffer is empty and there is (temporarily) nothing to read. In this case the loop will end before the whole response from the server is read.

Is there a mistake in the example or is my understanding incorrect ?

Here is the same example for Arduino, which seems ok to me : https://www.arduino.cc/en/Tutorial/Libr ... iWebClient

Who is online

Users browsing this forum: No registered users and 60 guests