I am trying to disable the IPV6_V6ONLY socket option .
int no = 0;
setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&no, sizeof(no));
Why did this fail with error 22 (EINVAL)?
This applies to OS X. It also does not work when it nois 1. Setting other socket parameters works, for example
int yes = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&yes, sizeof(yes));
source
share