Use getaddrinfo when opening sockets.