IPv4 & IPv6 dual protocol stack

Communication between the client and IPV6 IPV4 TCP server:
1 Start IPV6 server, create a listening socket port binding wildcard address
A record corresponding to the server 2 IPV4 call gethostbyname Found
3 call connect, send a SYN to the server IPV4
Server 4 sets a flag indicating that is mapped IPV4 IPV6 address, IPV4 of a corresponding SYN / ACK
All communication uses IPV4 5
 
IPV6 TCP communication between client and server IPV4:
1 Create IPV4 listen socket
2 IPV6 customers started asking IPV6 address with gethostbyname
3 call connect, resulting IPV4 IPV6 stored in a corresponding mapping IPV6 address socket structure. Check the kernel to address this mapping automatically sent to the server SYN IPV4
IPV4 server 4 with the SYN / ACK corresponding connection is established through the packet data IPV4
 
Connect customers can not call IPV4 or IPV6 address sendto designated as in_addr structure 4 bytes in IPV4's sockaddr_in structure, the fit 16-byte address v6

Reproduced in: https: //my.oschina.net/u/204616/blog/545385

Guess you like

Origin blog.csdn.net/weixin_34408624/article/details/91989529