TCP/IP Programming Manual
Usage Guidelines
Call this function once for each structure created by calls to getaddrinfo before closing a socket.
Upon successful completion, freeaddrinfo does not return a value. The address information
structure and associated storage are returned to the system.
Examples
INET6: the following IPv6 programming example calls the freeaddrinfo routine after the
getaddrinfo function returns a value:
#include <netdb.h>
...
struct addrinfo *res;
struct addrinfo *aip;
for(aip = res; aip!= NULL; aip = aip->ai_next){
/*create a socket, address type depends on getaddrinfo()
returned value */
sock=socket(aip->ai_family, aip->ai_socktype,
aip->ai_protocol);
if (sock == -1) {
perror("socket");
freeaddrinfo(res);
return(-1);
}
}
freehostent
The freehostent function frees the memory of one or more hostent structures returned by the
getipnodebyaddr or getipnodebyname functions. (This function is supported for NonStop
TCP/IP only.)
C Synopsis
#include <netdb.h>
void freehostent(struct hostent *ptr);
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
freehostent(ptr);
INT .EXT ptr(hostent);
ptr
input value; a pointer to the structure hostent.
Usage Guidelines
Call this function once for each hostent structure returned by the getipnodebyaddr or
getipnodebyname functions.
gai_strerror
The gai_strerror function aids applications in printing error messages based on the EAI_xxx
codes returned by the getaddrinfo function. The IPv6 functions getipnodebyaddr,
getipnodebyname, getaddrinfo, and getnameinfo return errors in a thread-safe structure.
freehostent 105