Skip to content

Commit eeb6c7b

Browse files
authored
LegacyEthernetTest: Check Ethernet.hostByName() for failure (#3)
1 parent d76b60e commit eeb6c7b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

examples/LegacyEthernetTest/LegacyEthernetTest.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ void setup() {
5252
Serial.print("Resolve IP for ");
5353
Serial.println(serverName);
5454
IPAddress resolvedIP;
55-
Ethernet.hostByName("www.google.com", resolvedIP);
56-
Serial.print("\t");
57-
Serial.println(resolvedIP);
55+
if (Ethernet.hostByName("www.google.com", resolvedIP) == 1) {
56+
Serial.print("\t");
57+
Serial.println(resolvedIP);
58+
} else {
59+
Serial.println("\t...ERROR");
60+
}
5861
Serial.println();
5962

6063
Ethernet.end();

0 commit comments

Comments
 (0)