diff --git a/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino b/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino index eb7c02eff3..4e3b78d5a0 100644 --- a/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino +++ b/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino @@ -71,9 +71,9 @@ void loop() { client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n"); - int timeout = millis() + 5000; + unsigned long timeout = millis(); while (client.available() == 0) { - if (timeout - millis() < 0) { + if (millis() - timeout > 5000) { Serial.println(">>> Client Timeout !"); client.stop(); return;