title: When i do getaddrinfo for localhost, I don't receive 127.0.0.1
body: <p>I am still learning sockets and am unclear why this doesn't print out 127.0.0.1. Even if I replace the word localhost with 127.0.0.1 I receive some other ip's which I guess are my router or something. I always thought this should return 127.0.0.1. Here's the output I receive:</p>
  
  <pre><code>hostname: 28.30.0.0
  hostname: 28.30.0.0
  hostname: 28.30.0.0
  hostname: 28.30.0.0
  hostname: 16.2.0.0
  hostname: 16.2.0.0
  </code></pre>
  
  <p>Here is the basic code:</p>
  
  <pre><code>#include &lt;sys/socket.h&gt;
  #include &lt;netinet/in.h&gt;
  #include &lt;arpa/inet.h&gt;
  #include &lt;netdb.h&gt;
  #include &lt;stdio.h&gt;
  
  int main()
  {
      struct addrinfo* feed_server = NULL;
  
      getaddrinfo("localhost", NULL, NULL, &amp;feed_server);
      struct addrinfo *res;
      for(res = feed_server; res != NULL; res = res-&gt;ai_next)
      {   
          printf("hostname: %s\n", inet_ntoa(*((struct in_addr*)(res-&gt;ai_addr))));
      } 
  
      return 0;
  }
  </code></pre>