Rewrote get_host_addr() to use getaddrinfo().