Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

freeaddrinfo() - release memory for addrinfo structure

&pagelevel(3)&pagelevel

#include <sys.socket.h>
#include <netdb.h>

Kernighan-Ritchie-C:
int freeaddrinfo(ai);

struct addrinfo *ai;

ANSI-C:
int freeaddrinfo(struct addrinfo* ai);


Description

The freeaddrinfo() function release memory area for a concatenated list of struct addrinfo objects which was requested beforehand with the getaddrinfo() function.

The ai parameter is a pointer to the first addrinfo object in a list of several concatenatedaddrinfo objects.


The addrinfo structure is declared as follows:

struct addrinfo {
  int              ai_flags;     /* AI_PASSIVE,AI_CANONNAME,AI_NUMERICHOST*/
  int              ai_family;    /* PF_INET,PF_INET6 */
  int              ai_socktype;  /* SOCK_STREAM,SOCK_DGRAM*/
  int              ai_protocol;  /* 0 (not supported in SOCKETS) */
  size_t           ai_addrlen;   /* length of the address */
  char*            ai_canonname; /* canon name of the node */
  struct sockaddr *ai_addr;      /* socket address structure of address */ 
                                 /* family AF_INET or AF_INET6 */
  struct addrinfo *ai_next;      /* next structure in concatenated list */
};

See also

getipnodebyname(), getipnodebyaddr()