- WiFi.hostByName(NTP_SERVER, ntpServerIP);
- Serial.print("Got NTP server " NTP_SERVER " address ");
- Serial.println(ntpServerIP);
+ if (WiFi.hostByName(NTP_SERVER, ntpServerIP) == 1) {
+ if (ntpServerIP == IPAddress(1,0,0,0)) {
+ Serial.println("DNS lookup failed for " NTP_SERVER " try again later.");
+ ntpServerIP = INADDR_NONE;
+ return;
+ }
+ Serial.print("Got NTP server " NTP_SERVER " address ");
+ Serial.println(ntpServerIP);
+ } else {
+ Serial.println("DNS lookup of " NTP_SERVER " failed.");
+ return;
+ }