Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By pidloop
#59721 Hello. I am connecting to a server with WiFiClient. I read using the usual loop with timeout:

Code: Select all        uint32_t t0 = millis();
        while (!cl.available()) {
            if (millis() - t0 > time_out)
                return (false); // timed out before seeing \n
            delay(10);
        }

        int c = cl.read();


This works ok but I must always wait for the timeout to know when connection is finished.

So my question is: Is there a way to know immediately when a connection has been closed by the remote side?

Thank you.