replace gethostbyname with getaddrinfo, see if that works for local ips and names better