Fixed socket creation semantics to avoid unnecessary dns lookups and to
create ipv4/ipv6 sockets based on the given host name.