Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
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.
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. */
s = socket(ainfo->ai_family, ainfo->ai_socktype,
ainfo->ai_protocol);
if (connect(s, ainfo->ai_addr, ainfo->ai_addrlen) == -1) {
perror(argv[0]);
fprintf(stderr, "unable to connect0);
FILE_CLOSE(S);
continue;
}
else
break;
}
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_flags.
EAI_FAIL Nonrecoverable failure in name resolution.
EAI_FAMILY ai_family not supported.
4−156 Hewlett-Packard Company 527187-017