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

Merge pull request #1160 from martinayotte/master

replace delay() with a while loop in WiFiClient.ino
This commit is contained in:
Ivan Grokhotkov 2015-12-06 19:52:41 +03:00
commit c4436d8d04

View File

@ -71,7 +71,14 @@ void loop() {
client.print(String("GET ") + url + " HTTP/1.1\r\n" + client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" + "Host: " + host + "\r\n" +
"Connection: close\r\n\r\n"); "Connection: close\r\n\r\n");
delay(10); int timeout = millis() + 5000;
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 // Read all the lines of the reply from server and print them to Serial
while(client.available()){ while(client.available()){