-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using an IP address for NTP connections #31
Comments
I think that if the server name is an IP address in the form of a string, it should just work, no? |
Yes, I expect it would still work, but all the other Arduino libraries seem to use the binary IPAddress datatype. Presumably because it takes up slightly less memory, and the connection code can avoid the need to recognise a numeric string, and convert it to binary? (I've just checked the source, and when UDP beginPacket() is called with a string IP address, it passes it to DNS getHostByName() which then runs inet_aton() to see if it is numeric, and converts it to binary.) |
Hi @sheffieldnick, That sounds like a good addition, could you please prepare a pull request for it? |
I've modified NTPClient() to accept an IP address as an alternative to the usual server name. This often speeds up an NTP fetch by avoiding the DNS lookup step.
NTPClient.h:
NTPClient.cpp:
The text was updated successfully, but these errors were encountered: