Skip to content

WiFi.hostByName resolves to 255.255.255.255 when should return error #7945

Answered by d-a-v
gnalbandian asked this question in Q&A
Discussion options

You must be logged in to vote

255.255.255.255 is INADDR_NONE.
In current git version, the resulting IP can be tested with .isSet() which tests if IP address is neither 0.0.0.0 or 255.255.255.255.
The bool() operator uses ::isSet() so you can do that:

    if (!ip)
        Serial.println("address not found");

Unfortunately v2.7.4 (latest release) ::isSet() does not check for NONE.
v3.0 of this core will be out soon, in the meantime you can use git master, or the "stage" version if you are using PlatformIO, or an unofficial snapshot release for the arduino IDE board manager.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gnalbandian
Comment options

Answer selected by gnalbandian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #7944 on March 26, 2021 16:01.