The getaddrinfo() function is the recommended POSIX function for interfacing with the system resolver. Depending on system configuration it will perform name lookups in the DNS, /etc/hosts, mDNS, etc.
It is preferred over the deprecated gethostbyname() family of functions because it supports both ...