C:addrinfo
lastmod 2026-11-10created 2019-09-093 edits
addrinfo is the address information structure returned by getaddrinfo in C socket programming. It holds the address family (ai_family), socket type (ai_socktype), protocol, and the socket address with its length, and forms a linked list through ai_next to express that a single host name can resolve to multiple addresses. The caller walks the list trying socket and connect, and must free it with freeaddrinfo when done; it lets IPv4 and IPv6 be handled with the same code.