|
Different platforms have different solutions on implementing both IPv4 and IPv6 simultaneously, and this affects how servers listen.
There is the parallel stack and the unified stack approach.
With the parallel stack approach, IPv4 and IPv6 are totally independent stacks and port 53 TCP/IPv4 is different to port 53 TPC/IPv6. A server has to bind and listen on both these ports.
With the unified stack approach the following happens:
If you create an IPv4 socket, it only works on IPv4, end of story.
If you create an IPv6 socket, it will work with both IPv4 and IPv6 clients.
Then there are platforms which require you to create both an IPv4 and an IPv6 socket, but the ports are common, hence you have to set the SO_REUSEADDR flag in order to bind both IPv4 and IPv6 to the same port.
The address "loopback" will resolve typically to 127.0.0.1 which is the IPv4 loopback address. As you point out "::1" is the loopback for IPv6.
|