Use getaddrinfo to get ipv6 working

I've improved https://github.com/pika/pika/issues/309 solution by using getaddrinfo.
In this way I get the first result got by getaddrinfo and use the resulting data to select if to use ipv6 or ipv4 as network protocol based on the input address.
I've removed socket.has_ipv6 since it could return true also without ipv6 connection nor ipv6 dns resolving.