From dd3ef10b5fcedcbdf62e7790589d49787416a0bf Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Wed, 15 Nov 2023 16:08:20 -0800 Subject: [PATCH] LegacyEthernetTest: Check Ethernet.hostByName() for failure --- examples/LegacyEthernetTest/LegacyEthernetTest.ino | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/LegacyEthernetTest/LegacyEthernetTest.ino b/examples/LegacyEthernetTest/LegacyEthernetTest.ino index 96bf624..5033c9d 100644 --- a/examples/LegacyEthernetTest/LegacyEthernetTest.ino +++ b/examples/LegacyEthernetTest/LegacyEthernetTest.ino @@ -52,9 +52,12 @@ void setup() { Serial.print("Resolve IP for "); Serial.println(serverName); IPAddress resolvedIP; - Ethernet.hostByName("www.google.com", resolvedIP); - Serial.print("\t"); - Serial.println(resolvedIP); + if (Ethernet.hostByName("www.google.com", resolvedIP) == 1) { + Serial.print("\t"); + Serial.println(resolvedIP); + } else { + Serial.println("\t...ERROR"); + } Serial.println(); Ethernet.end();