diff --git a/examples/PlaneSpotterDemo/AdsbExchangeClient.cpp b/examples/PlaneSpotterDemo/AdsbExchangeClient.cpp index 481737b..c382e72 100644 --- a/examples/PlaneSpotterDemo/AdsbExchangeClient.cpp +++ b/examples/PlaneSpotterDemo/AdsbExchangeClient.cpp @@ -45,7 +45,7 @@ void AdsbExchangeClient::updateVisibleAircraft(String searchQuery) { int size = 0; client.setNoDelay(false); - while(client.connected()) { + while(client.available() || client.connected()) { while((size = client.available()) > 0) { c = client.read(); if (c == '{' || c == '[') { diff --git a/src/AerisForecasts.cpp b/src/AerisForecasts.cpp index 737ce5b..1b2c5de 100644 --- a/src/AerisForecasts.cpp +++ b/src/AerisForecasts.cpp @@ -58,7 +58,7 @@ void AerisForecasts::doUpdate(AerisForecastData *forecasts, String url, uint8_t WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { if ((millis() - lost_do) > lostTest) { Serial.println ("lost in client with a timeout"); diff --git a/src/AerisObservations.cpp b/src/AerisObservations.cpp index 72675a9..02b9439 100644 --- a/src/AerisObservations.cpp +++ b/src/AerisObservations.cpp @@ -56,7 +56,7 @@ void AerisObservations::doUpdate(AerisObservationsData *observations, String url WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { if ((millis() - lost_do) > lostTest) { Serial.println ("lost in client with a timeout"); diff --git a/src/AerisSunMoon.cpp b/src/AerisSunMoon.cpp index 61cdd86..fb9fad6 100644 --- a/src/AerisSunMoon.cpp +++ b/src/AerisSunMoon.cpp @@ -57,7 +57,7 @@ void AerisSunMoon::doUpdate(AerisSunMoonData *sunMoonData, String url) { WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { if ((millis() - lost_do) > lostTest) { Serial.println ("lost in client with a timeout"); diff --git a/src/ThingspeakClient.cpp b/src/ThingspeakClient.cpp index 6310fb8..3ff4bf8 100644 --- a/src/ThingspeakClient.cpp +++ b/src/ThingspeakClient.cpp @@ -45,7 +45,7 @@ void ThingspeakClient::getLastChannelItem(String channelId, String readApiKey) { int size = 0; client.setNoDelay(false); - while(client.connected()) { + while(client.available() || client.connected()) { while((size = client.available()) > 0) { c = client.read(); if (c == '{' || c == '[') { diff --git a/src/TimeClient.cpp b/src/TimeClient.cpp index 36f2002..d8716be 100644 --- a/src/TimeClient.cpp +++ b/src/TimeClient.cpp @@ -56,7 +56,7 @@ void TimeClient::updateTime() { int size = 0; client.setNoDelay(false); - while(client.connected()) { + while(client.available() || client.connected()) { while((size = client.available()) > 0) { line = client.readStringUntil('\n'); line.toUpperCase(); diff --git a/src/WorldClockClient.cpp b/src/WorldClockClient.cpp index ae89579..507ee88 100644 --- a/src/WorldClockClient.cpp +++ b/src/WorldClockClient.cpp @@ -93,7 +93,7 @@ void WorldClockClient::updateTime() { int size = 0; client.setNoDelay(false); - while(client.connected()) { + while(client.available() || client.connected()) { while((size = client.available()) > 0) { c = client.read(); if (c == '{' || c == '[') { diff --git a/src/WundergroundAlerts.cpp b/src/WundergroundAlerts.cpp index 6085399..96b1da9 100644 --- a/src/WundergroundAlerts.cpp +++ b/src/WundergroundAlerts.cpp @@ -82,7 +82,7 @@ void WundergroundAlerts::doUpdate(WGAlert *alerts, uint8_t maxAlerts, String url WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { c = client->read(); if (c == '{' || c == '[') { diff --git a/src/WundergroundAstronomy.cpp b/src/WundergroundAstronomy.cpp index 585c374..1ca42e0 100644 --- a/src/WundergroundAstronomy.cpp +++ b/src/WundergroundAstronomy.cpp @@ -68,7 +68,7 @@ void WundergroundAstronomy::doUpdate(WGAstronomy *astronomy, String url) { WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { c = client->read(); if (c == '{' || c == '[') { diff --git a/src/WundergroundClient.cpp b/src/WundergroundClient.cpp index 84cc153..498e600 100644 --- a/src/WundergroundClient.cpp +++ b/src/WundergroundClient.cpp @@ -162,7 +162,7 @@ void WundergroundClient::doUpdate(String url) { parser.parse(c); } } - } while(client.connected()); + } while(client.available() || client.connected()); } void WundergroundClient::whitespace(char c) { diff --git a/src/WundergroundConditions.cpp b/src/WundergroundConditions.cpp index 2dc8e52..c12d7d6 100644 --- a/src/WundergroundConditions.cpp +++ b/src/WundergroundConditions.cpp @@ -72,7 +72,7 @@ void WundergroundConditions::doUpdate(WGConditions *conditions, String url) { WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { if ((millis() - lost_do) > lostTest) { Serial.println ("lost in client with a timeout"); diff --git a/src/WundergroundForecast.cpp b/src/WundergroundForecast.cpp index c8a9adc..4ec6e03 100644 --- a/src/WundergroundForecast.cpp +++ b/src/WundergroundForecast.cpp @@ -74,7 +74,7 @@ void WundergroundForecast::doUpdate(WGForecast *forecasts, uint8_t maxForecasts, WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { if ((millis() - lost_do) > lostTest) { Serial.println ("lost in client with a timeout"); diff --git a/src/WundergroundHourly.cpp b/src/WundergroundHourly.cpp index f01c07c..7cf1822 100644 --- a/src/WundergroundHourly.cpp +++ b/src/WundergroundHourly.cpp @@ -72,7 +72,7 @@ void WundergroundHourly::doUpdate(WGHourly *hourlies, String url) { if(httpCode > 0) { WiFiClient * client = http.getStreamPtr(); - while(client->connected()) { + while(client->available() || client->connected()) { while((size = client->available()) > 0) { c = client->read(); if (c == '{' || c == '[') {