Corrected socket connect for IPv6 hosts

Summary: This diff uses the standard method of fetching a host name via
`getaddrinfo` and looping over all the hosts found until one is
successfully conntected.

Reviewed By: @ptarjan

Differential Revision: D1459761