If TCP/IP service provider supports IPv6 addressing, it must install itself twice: once for IPv4 and once for IPv6 address family. So, WSAEnumProtocols will return two WSAPROTOCOL_INFO structures for each of the supported socket types (SOCK_STREAM, SOCK_DGRAM, SOCK_RAW). The iAddressFamily must by set to AF_INET for IPv4 addressing, and to AF_INET6 for IPv6 addressing.
The IPv6 addresses are described in the following structures:
struct sockaddr_in6 {
short sin6_family; /* AF_INET6 */
u_short sin6_port; /* Transport level port number */
u_long sin6_flowinfo; /* IPv6 flow information */
struct in_addr6 sin6_addr; /* IPv6 address */
};
struct in_addr6 {
u_char s6_addr[16]; /* IPv6 address */
};
If an application uses Windows Sockets 1.1 functions and wants to use IPv6 addresses, it may continue to use all the old functions which take
struct sockaddr
as one of the parameters (bind, connect, sendto, recvfrom, accept, etc.). The only change that is required is to use struct sockaddr_in6
instead of struct sockaddr
. However, all the name resolution functions (gethostbyname, gethostbyaddr, etc.) and address conversion functions (inet_addr, inet_ntoa) can not be reused because they assume an IP address of 4 bytes in length. An application which wants to do name resolution and address conversion for IPv6 addresses must use Windows Sockets 2 specific functions (WSAStringToAddress, WSAAddressToString, etc.)
The multicast for IPv6 has to be specified in more details in a later version.