Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (i - m) lwres_getipnodebyname(3)
EXAMPLE
The address pointed to by hp, which is already in network order, can be used directly in a
sockaddr_in or sockaddr_in6 structure, as in the following example:
struct sockaddr_in sin;
struct hostent *hp;
if ((hp = lwres_getipnodebyname (nameptr, AF_INET, AI_PASSIVE,
&error_num)) != (struct hostent *) NULL) {
memmove ((char *)&sin.sin_addr.s_addr, (char *)hp -> h_addr,
(size_t) hp -> h_length );
}
NOTES
The hostent structure is statically declared. Subsequent calls to lwres_gethostbyname( ) replace
the existing data in the hostent structure.
RETURN VALUES
Upon successful completion of the call, the lwres_getipnodebyname( ) function returns a
pointer to a structure of type hostent whose members specify data obtained from a name server.
ERRORS
If an error occurs, lwres_getipnodebyname( ) sets the value pointed to by error_ptr to an
appropriate error code and the function returns a NULL pointer. The following error codes and
their meanings are defined in the netdb.h header file:
HOST_NOT_FOUND
The specified host was not found.
TRY_AGAIN A temporary and possibly transient error occurred, such as the failure of a server
to respond.
NO_RECOVERY
An unexpected server failure occurred that cannot be recovered.
NO_ADDRESS
The specified host name is valid, but the host does not have an IP address.
Another type of request to the name server for the domain might return an error.
RELATED INFORMATION
Functions: getipnodebyname(3), lwres_hstrerror(3).
527187-017 Hewlett-Packard Company 4−167