Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

lwres_getaddrinfo(3) OSS Library Calls Reference Manual
This function provides the same information as the getaddrinfo() function but uses the Domain
Name System (DNS) lightweight resolver server lwresd instead of the named DNS server.
RETURN VALUES
lwres_getaddrinfo) returns 0 (zero) on success or one of the error codes listed in the ERRORS
section of this reference page if an error occurs.
ERRORS
EAI_ADDRFAMILY
Address family for host name not supported.
EAI_AGAIN Temporary failure in name resolution.
EAI_BADFLAGS
Invalid value for ai_ags.
EAI_FAIL Nonrecoverable failure in name resolution.
EAI_FAMILY ai_family not supported.
EAI_MEMORY
Memory allocation failure.
EAI_NODATA
No address associated with the specied host name.
EAI_NONAME
The host name or server name was not provided or is not known.
EAI_SERVICE
The server named is not supported for ai_socktype.
EAI_SOCKTYPE
ai_socktype is not supported.
EAI_SYSTEM
System error was returned in errno.
If both host name and service are NULL, lwres_getaddrinfo() returns EAI_NONAME.
EXAMPLE
struct addrinfo *res, *ainfo;
struct addrinfo hints;
int ret;
char *hostname, *servname;
/* clear out hints */
memset ((char *)&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(hostname, servname, &hints, &res);
if (ret != 0) {
fprintf(stderr, "%s not found in name service database0,
hostname);
exit(1);
}
for (ainfo = res; ainfo != NULL; ainfo = ainfo->ai_next) {
/* Create the socket. */
498 Hewlett-Packard Company 527187-004