This opens and interesting "issue"...

Why are dealing ourselves with IPv4 vs IPv6 differences in the code? Shouldn't this be determined by the underlying libraries at the end? In this case, for example, if I'm using a name, I understand that should be the DNS resolving orion.lab.fi-ware.eu the one who will provide the corresponding type (either IPv4 or IPv6).

Moreover, I would like to have the logic of the code nor dependant on IPv4 or IPv6... The gethostbyname/getaddrinfo/othermagicfunction should provide an abstract way of dealing with this.

I'm not an expert in IPv6 programming, so probably I'm missing some point...