Skip to content

Commit 6fa70bd

Browse files
committed
replace delay with while loop in WiFiClient.ino
1 parent 1368a82 commit 6fa70bd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino

+7-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ void loop() {
7171
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
7272
"Host: " + host + "\r\n" +
7373
"Connection: close\r\n\r\n");
74-
delay(10);
74+
while (client.available() == 0) {
75+
if (timeout - millis() < 0) {
76+
Serial.println(">>> Client Timeout !");
77+
client.stop();
78+
return;
79+
}
80+
}
7581

7682
// Read all the lines of the reply from server and print them to Serial
7783
while(client.available()){

0 commit comments

Comments
 (0)