问题描述
我有一个使用 ipv4 编写的小 udp 示例程序.如果我将代码更改为 ipv6,我是否仍然能够与使用具有 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.
推荐答案
是与否... IPv6 确实包含完全不同的寻址,因此您必须重新编码您的应用程序以使用替代标头和结构大小.
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.
但是,IPv4 地址范围在 IPv6 中可用,语法是在标准地址前添加两个冒号(例如 ::10.11.12.13).您还可以在 IPv6 数据包中嵌入 IPv4 地址.
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.
这篇关于ipv6 向后兼容 ipv4 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!