Replace use of gethostbyname by getaddrinfo

This replaces the remaining gethostbyname() call by the equivalent
getaddrinfo() call required to properly cope with hosts being only
reachable over IPv6.