dns: introduce lookupService function

Uses getnameinfo to resolve an address an port into a hostname and
service.