Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

freeaddrinfo(3) OSS Library Calls Reference Manual
NAME
freeaddrinfo - Frees address information structure and storage for IPv6 socket
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
#include <netdb.h>
void freeaddrinfo(
struct addrinfo *ai);
PARAMETERS
ai Specifies the address information structure to be freed
DESCRIPTION
The freeaddrinfo( ) function frees a specified address information structure previously created
by the getaddrinfo( ) function. Any dynamic storage pointed to by the structure is also freed.
EXAMPLES
.
.
.
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");
freaddrinfo(res);
return(-1);
}
}
NOTES
Call this function once for each structure created by calls to getaddrinfo( ) before closing a
socket.
RETURN VALUES
Upon successful completion, this function does not return a value. The address information
structure and associated storage have been returned to the system. Otherwise, an invalid address
reference causes application failure and results in a signal.
ERRORS
This function does not set errno.
2148 Hewlett-Packard Company 527187-017