Search code examples
c++udpipv6ipv4

is ipv6 backward compatible with ipv4?


I've got a little udp example program written using ipv4. If I alter the code to ipv6 would I still be able to communicate with anyone using the listener with an ipv4 address? I was looking at porting examples at

http://ou800doc.caldera.com/en/SDK_netapi/sockC.PortIPv4appIPv6.html

I'm not sure if simply altering the code would ensure that it worked or if I'd have to write it in duel-stack mode.


Solution

  • Yes and no... IPv6 does contain completely different addressing, so you'll have to recode your app to use the alternative headers and structure sizes.

    However, the IPv4 address range is available within IPv6, the syntax is to add two colons before the standard address (eg ::10.11.12.13). You can also embed IPv4 addresses within IPv6 packets.