title: Can't turn off socket option IPV6_V6ONLY
body: <p>I'm trying to <a href="https://stackoverflow.com/questions/1618240/how-to-support-both-ipv4-and-ipv6-connections">turn off the socket option IPV6_V6ONLY</a>. </p>
  
  <pre><code>int no = 0;     
  setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&amp;no, sizeof(no)); 
  </code></pre>
  
  <p><strong>Why does the above fail with errno 22 (EINVAL)?</strong></p>
  
  <p>This is on OS X. It also doesn't work when <code>no</code> is 1. Setting other socket options works, for example</p>
  
  <pre><code>int yes = 1;
  setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&amp;yes, sizeof(yes)); 
  </code></pre>