TCP/IP Programming Manual

int lwres_getaddrinfo (const char *hostname, const char
*servname, const struct addrinfo *hints, struct addrinfo **result);
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
error := lwres_getaddrinfo (hostname, servname, hints, result);
INT error;
STRING .EXT hostname;
STRING .EXT servname;
INT .EXT hints(addrinfo);
INT .EXT result(addrinfo);
hostname
input value; specifies a pointer to a character representing one of the following:
An Internet node hostname.
An IPv4 address in dotted-decimal format.
An IPv6 address in hexadecimal format.
NULL if no hostname requires converting; when NULL is used, either service or hints
must be non-NULL.
servname
input value; specifies a pointer to a character representing one of the following:
A network service name.
A decimal port number.
NULL if no service name requires converting; when NULL is used, either hostname or hints
must be non-NULL.
hints
input value; specifies one of the following:
A pointer to an addrinfo struct for a socket; the format of the addrinfo structure is
defined in the header file netdb.h.
NULL if no struct is available; when NULL is used, either hostname or service must be
non-NULL.
result
input and return value; points to a list of addrinfo structs upon successful completion (See
Usage Guidelines (page 144).)
Errors
lwres_getaddrinfo returns zero (0) on success or one of the error codes listed in
lwres_gai_strerror if an error occurs. If both hostname 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));
lwres_getaddrinfo 143