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 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 set h_errno as for gethostbyname() in POSIX 1003.1-2008 (ISO/IEC 9945-2009).

Errors

The gethostbyname2() shall set h_errno as for gethostbyname() in POSIX 1003.1-2008 (ISO/IEC 9945-2009).