If our server (running on a device) starts before a DHCP lease had been acquired then it can never connect using a hostname.
If that happens it can find hosts by IP address but not by DNS.
I initially thought that the Curl DNS cache was at fault as the curl connections failed. But I used CURLOPT_DNS_CACHE_TIMEOUT to prevent curl from caching address but connections still failed.
res_init()
is much less portable than thelibcurl
API. On some Curl-supporting platforms it doesn't exist; on many others it's not thread-safe. – Staff