Use the following option to control IPv4 and IPv6 communications:
- IPV6_V6ONLY
- An AF_INET6 socket can be used for IPv6 communications, IPv4 communications,
or a mix of IPv6 and IPv4 communications. The IPV6_V6ONLY socket
option allows an application to limit an AF_INET6 socket to IPv6 communications
only. A nonzero socket option value enables the option; a value of
0 disables the option.
A getsockopt() with this option returns
the value set by a setsockopt(). If a setsockopt() has not been done,
the default value of 0 (disabled) is returned.
If an application
wants to enable this option, the setsockopt() must be set before binding
the socket, connecting the socket, or sending data over the socket.
This option cannot be changed (either enabled or disabled) after
the socket has been bound. (An implicit bind is done for datagram
sockets on connect or send operations if the socket is not already
bound.)