Issues in rewriting client side First, query name by getaddrinfo() Do not socket() before name resolution; AF can change. Loop through the names returned The DNS database for the peer may wrongly be configured. IPv4 network can be down while IPv6 is alive, and vice versa. Use a port number/name string, not htons(port) IPv4 mapped address (e.g. ::ffff:127.0.0.1) Using IPv4 transport from AF_INET6 socket. Do not rely on this - complicated specification, low portability.