Use getaddrinfo() instead of gethostbyname().

The latter is not re-entrant, so not thread-safe.

At the same time, support round-robin DNS in a sort of trivial way.
Merge pull request #85 from unknownbrackets/resolve

Use getaddrinfo() instead of gethostbyname()