title: The purpose of ai_next and ai_addr inside the addrinfo struct
body: <p>I am teaching myself socket programming and I've recently come across <code>getaddrinfo</code> and the <code>addrinfo</code> struct. From my understanding, the majority of the files in the struct are ints that you can use by specifying macros, for example, if I wanted to <code>AF_INET</code> in my <code>addrinfo</code> struct, I would specify either <code>AF_INET</code>, or the integer 2 (I don't know this for sure, what header file is it declared in?).
  Well, I don't think I quite understand why there is an sockaddr and pointer to another addrinfo. I've been told that the latter creates a linked list, but what is the purpose behind it? </p>