title: Mac/Windows different formats for in_addr structure (IPv4 address)
body: <p>I'm porting some Windows code to the Mac. I've come across some code using the type <code>in_addr</code> and found the documentation for the Windows implementation here: <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms738571%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/ms738571%28v=vs.85%29.aspx</a></p>
  
  <p>Specifically the problem I am having is that the code tries to access the <code>S_un</code> property of in_addr, which the compiler (CLang) complains doesn't exist. Looking at the definition for the Mac implementation I get this (in <code>usr/include/netinet/in.h</code>):</p>
  
  <pre><code>struct in_addr {
      in_addr_t s_addr;
  };
  </code></pre>
  
  <p>...and <code>in_addr_t</code> is defined as follows (in <code>usr/include/sys/types.h</code>):</p>
  
  <pre><code>typedef __uint32_t      in_addr_t;
  </code></pre>
  
  <p>Does anyone know of a good workaround for this, or if there is a representation of IPv4 addresses on the Mac that is more closely tied to the Windows implementation?</p>