What I don't understand is the **res
double pointer, in the man page it states:
The hints argument points to an addrinfo structure that specifies criteria for selecting the socket address structures returned in the list pointed to by res.
I see that *hints
is a pointer to the addrinfo
struct but how is **res
returning the socket address structures?
int getaddrinfo(const char *node, const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};