1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

replace delay with while loop in WiFiClient.ino

This commit is contained in:
Martin Ayotte 2015-12-06 09:42:51 -05:00
parent 1368a82a82
commit 6fa70bda01

View File

@ -71,7 +71,13 @@ void loop() {
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
delay(10);
while (client.available() == 0) {
if (timeout - millis() < 0) {
Serial.println(">>> Client Timeout !");
client.stop();
return;
}
}
// Read all the lines of the reply from server and print them to Serial
while(client.available()){