This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Description
Common application behaviour when connecting to a remote host is to lookup that host in DNS (getaddrinfo) and then loop through the list of addresses returned to attempt to connect to one.
In node, net.connect() calls dns.lookup() which only ever returns the first A or AAAA address for the specified host. This causes horrible problems when trying to connect to a host which returns both A and AAAA addresses when the client only has IPv4 or IPv6 (not both) connectivity; worse still, this can be inconsistent as the return order of getaddrinfo can be arbitrary.