Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (g - h) gethostbyaddr_r(3)
The structure of type hostent is defined in the netdb.h header file as:
struct hostent {
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
The fields of this structure are:
h_name Points to the official name of the host. This name is also known as the canonical
name of the host.
h_aliases Points to an array of pointers to alternate names for the host.
h_addrtype The type of address being returned. Its value is always AF_INET, which indi-
cates that this is an Internet address.
h_length The length, in bytes, of each entry pointed to by h_addr_list. Typically,
h_length is four bytes
h_addr_list Points to an array of null-terminated pointers to the addresses from the name
server, in network order.
ERRORS
If the length of the buffer supplied by the caller is not large enough to store the result, this func-
tion returns a null pointer and sets both h_errno and the integer pointed to by h_errnop to the
value ERANGE.
If the gethostbyaddr_r( ) function fails, h_errno and the integer pointed to by h_errnop might
be set to one of the following values:
HOST_NOT_FOUND
The name is not a valid hostname or alias. Another type of name server request
might be successful.
NO_DATA | NO_ADDRESS
The address you used is not valid. Another type of name server request might be
successful.
NO_RECOVERY
A server failure occurred. This is a nonrecoverable error.
TRY_AGAIN A transient condition might have caused an error. A later retry might succeed.
ERANGE Insufficient storage was supplied via buffer and buflen to contain the data to be
referenced by the resulting hostent structure.
Additionally, for H06.20 or earlier H-series RVUs, J06.09 or earlier J-series RVUs, or G-series
RVUs, gethostbyaddr_r( ) might set errno to the following values:
[ERANGE] Insufficient storage was supplied via buffer and buflen to contain the data to be
referenced by the resulting hostent structure.
527187-017 Hewlett-Packard Company 3−55