title: Why does getaddrinfo require 3 headers?
body: <p>Whenever I see <code>getaddinfo()</code> used, I've seen it come alongside 3 headers:</p>
  
  <pre><code>#include &lt;sys/types.h&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;netdb.h&gt;
  </code></pre>
  
  <p>Also, <a href="http://linux.die.net/man/3/getaddrinfo" rel="nofollow">the documentation</a> groups this function alongside 2 others and lists the same 3 headers.  Why does it appear that <code>getaddrinfo()</code> requires 3 headers -- or at the very least, how can we figure out which ones are actually necessary for the function?</p>