I have a program that listens for connections and handles them. I am aware that many networking stacks support accepting IPv4 and IPv6 connections over the same socket/port, but I’ve also heard that Windows XP isn’t one of those. In the interest of having the same code run well on all platforms, should I just listen for IPv6 connections on a separate port?
Share
Windows XP SP2+ implements
dual-stack IParchitecture. That means that you can have two sockets (one for AF_INET and another one for AF_INET6 family) which are bound to the same port number. This works quite fine.Note: if your intention was to have a single socket to handle both IPv4 and IPv6 connections then you depend on the so called
dual IP layer stackarchitecture implemented in Windows Vista and later (in this case you’ll have to disableIPV6_V6ONLYoptions on that socket).Refer to Microsoft’s Objectives for IP Version 6
Check also general recomendations in Application Aspects of IPv6 Transition (RFC 4038) .
PS: currently accepted answer by BiggsTRC is generally inaccurate as explained in the corresponding comments. However, if you are Ok with using two port numbers – then that answer still makes perfect sense.
PS2: I used terminology from the linked article. Not sure if any other platform uses this kind of separation between
dual-stackanddual-layerterms.