TCP/IP address information
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char * ai_canonname;
struct sockaddr * ai_addr;
struct addrinfo * ai_next
};
The addrinfo structure describes address information for use
with TCP/IP.
To get this information, call
getaddrinfo();
to free a linked list of these structures, call
freeaddrinfo().
The addrinfo structure includes these members:
- ai_flags
- Flags.
Includes AI_PASSIVE, AI_CANONNAME, and AI_NUMERICHOST.
For a complete list, see <netdb.h>.
- ai_family
- Protocol family.
Includes PF_UNSPEC and PF_INET.
For a complete list, see <sys/socket.h>.
- ai_socktype
- Socket type.
Includes SOCK_STREAM and SOCK_DGRAM.
For a complete list, see <sys/socket.h>.
- ai_protocol
- Protocol.
Includes IPPROTO_TCP and IPPROTO_UDP.
For a complete list, see <netinet/in.h>.
- ai_addrlen
- The length of the ai_addr member.
- ai_canonname
- The canonical name for nodename.
- ai_addr
- Binary socket address.
- ai_next
- A pointer to the next addrinfo structure in the linked
list.
POSIX 1003.1
freeaddrinfo(),
gai_strerror(),
getaddrinfo()