title: Determining IP Address from URL in iOS
body: <p>I need to get the IP address of a CDN from it's URL in an iOS app. From a long stack search, i've determined a method for doing this with the following:</p>
  
  <pre><code>struct hostent *host_entry = gethostbyname("stackoverflow.com");
  char *buff;
  buff = inet_ntoa(*((struct in_addr *)host_entry-&gt;h_addr_list[0]));
  // buff is now equal to the IP of the stackoverflow.com server
  </code></pre>
  
  <p>However, when using this code snippet, my app fails to compile and presents this warning: "dereferencing pointer to incomplete type"</p>
  
  <p>I have no knowledge of structs and I do not know how to fix this. Any suggestions?</p>
  
  <p>I also tried:</p>
  
  <pre><code>#include &lt;ifaddrs.h&gt;
  #include &lt;arpa/inet.h&gt;
  </code></pre>
  
  <p>But the result is the same warning.</p>