title: Data Type - socklen_t, sa_family_t
body: <p>I'm building a simple socket web server using the <a href="http://pubs.opengroup.org/onlinepubs/7908799/xns/syssocket.h.html" rel="nofollow noreferrer">sys/socket.h</a> lib, and I came across the <code>socklen_t</code> and <code>sa_family_t</code> data types and am a bit confused on what their actual purpose is.</p>
  <p>Definition:</p>
  <ul>
  <li><code>sa_family_t</code> - unsigned integer type.</li>
  <li><code>socklen_t</code> - an unsigned opaque integer type of length of at least 32-bits.</li>
  </ul>
  <p>Now I understand that the <code>&lt;sys/socket&gt;</code> lib declares three structures (<code>sockaddr</code>,<code>msghdr</code>,<code>cmsghdr</code>)  which contain members that declare these data  types.</p>
  <ul>
  <li><code>sa_family_t   sa_family       address family</code></li>
  <li><code>socklen_t     msg_namelen     size of address</code></li>
  <li><code>socklen_t     msg_controllen  ancillary data buffer len</code></li>
  <li><code>socklen_t     cmsg_len        data byte count, including the cmsghdr</code></li>
  </ul>
  <p>But why create new data types, why not just use an <code>unsigned int</code> data type?</p>