title: Linux networking (gethostbyaddr)
body: <p>I am trying to get host information about the host with IP address <strong>89.249.207.231</strong>. I know that it exists, because when I type the IP address in my browser's url field it finds the page. Here is my code in C.</p>
  
  <pre><code>#include &lt;netinet/in.h&gt;
  #include &lt;arpa/inet.h&gt;
  #include &lt;netdb.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
  
  int main()
  {
      struct in_addr addr;
      inet_aton("89.249.207.231", &amp;addr);
      struct hostent* esu = gethostbyaddr((const char*)&amp;addr),sizeof(addr), AF_INET);
      printf("%s\n", esu-&gt;h_name);
      return 0;
  }
  </code></pre>
  
  <p>When I compile and run it, it gives "Segmentation fault". I can not understand the problem with my code.</p>
  
  <p>Any hints and suggestions would be appreciated.</p>
  
  <p>Thanks!</p>