I couldn’t get the inbuilt DNS lookup to work when using TCP Client on a very slow internet connection, so i ported the arduino ethernet library.
May also be useful if you want to specify your own DNS server. Ive included a very simple example code, change the hostname to what you want to look up and it will tell you the IP address.
Do you mind adding this as a library, so that others (i.e. me - haha) can get easy access to it from the Spark IDE? Thanks for contributing it, and look forward to trying it out!
(I’d add it myself, but I’m not sure it’s good form to add someone else’s library to the IDE… )
Sorry about that, got a bit excited when tidying up the repo and removing extra folders etc. the myUDP.h is just a header file that overloads the built-in functions, it in a way grabs all the little bits and sends them as one datagram instead of lots of little ones so there is no matching cpp.
Ive also added loads of comments so you can easily see what can be removed from the example, and what the returned error codes mean, any issues let me know
Did you test the same core on a faster network? I have 6 cores using the same internet connection and only two of them are having problems with DNS. I was curious if you tested a problem core (on slow internet) with a faster internet and the problem went away?
I have unfortunately had all 3 of the issues that lead to needing the library… The corrupt DNS of 76.83.0.0 on one core. A router that doesn’t have a working DNS server and lastly a slow connection that takes more than 1 second to do a lookup the library fixes all 3.
The bad router was fixed by putting another router with manual DNS setup and the slow Internet I couldn’t do anything about but the cores work normal at home
The DHCP server on my wifi router assigns DNS servers from my ISP. What should I do to get the domain lookup search for .local hostnames first in the LAN?
I’ve tried this on a raspberrypi.local hostname, which is basically a RPi connected to the same WLAN. The .local hostname is ping-able from terminal, but I get a -5 error code when trying to connect from my Spark Core.
In this case, what DNS server should I provide for dnsServerIP()?