Note: The gethostbyname2() function is deprecated; applications should use getaddrinfo() instead.
The gethostbyname2() function shall search the network host database for an entry with name name. This function is similar to the gethostbyname() function but additionally allows the search to be restricted to a particular address family specified by af.
On success, the gethostbyname2() function shall return a pointer to a hostent structure if the requested entry was found, and a null pointer otherwise.
On unsuccessful completion, gethostbyname2() shall
for gethostbyname() in ISO POSIX (2003).
The gethostbyname2() shall set
as for gethostbyname() in ISO POSIX (2003).