gethostbyname2

Name

gethostbyname2 -- find network host database entry matching host name (DEPRECATED)

Synopsis

int gethostbyname2(const char * restrict name, int af);

Description

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.

Return Value

On success, the gethostbyname_r() function shall return zero. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small. If the gethostbyname_r() function returns returns any other value, then the variable referenced by h_errnop shall be set to indicate the cause as for gethostbyname().