何时使用混合IP符号:: ffff:192.168.1.4? [英] When is the hybrid IP notation ::ffff:192.168.1.4 appropriate?

查看:493
本文介绍了何时使用混合IP符号:: ffff:192.168.1.4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

换一种说法,如果地址是IPv4,为什么还要麻烦地将其表示为IPv6?

Put another way, if an address is IPv4, why bother to express it as IPv6 at all?

推荐答案

它是通过IPv6表示的IPv4,因此应用程序仅需要支持一个IP堆栈.

It’s IPv4 expressed through IPv6 so that the application only needs to support one IP stack.

能够通过IPv6表示法引用IPv4地址意味着我可以在自己的应用程序中真正获得对IPv6的支持,而不必担心重复的工作.

Being able to reference IPv4 addresses through IPv6 notation means I can work on getting IPv6 support really solid in my application, and not have to worry about duplicating effort.

这几天,某些发行版本默认情况下禁用IPv4兼容性(例如Debian),Windows默认情况下也会这样做.为了适应程序员的需要,您应该绑定两个套接字:一个IPv4套接字,以及一个带有IPV6_V6ONLY标志的IPv6套接字(这会强制它绑定IPv6,而无论/proc/sys/net/ipv6/bindv6only的状态如何,都没有IPv4兼容性).

These days some distributions disable IPv4 compatibility by default (e.g. Debian), and also Windows does this by default. To accommodate this as a programmer you should bind two sockets: one IPv4 socket, and one IPv6 socket with the IPV6_V6ONLY flag (which forces it to bind IPv6–only with no IPv4 compatibility, no matter the state of /proc/sys/net/ipv6/bindv6only).

在下面的评论中,迈克将我链接到这个很棒的网站,其中包含您的信息应该使用sockaddr_storage进行与AF_无关的编程(与您决定使用AF_INET6还是决定并排使用AF_INET和AF_INET6密切相关).我也喜欢Beej的《网络编程指南》,其中有一些类似的信息也是.推荐阅读.谢谢,迈克!

In the comments below, Mike linked me to this great site with info on how you should use sockaddr_storage for AF_–independent programming (which has great relevance whether you decide to go AF_INET6, or decide to use AF_INET and AF_INET6 side by side). Also I like Beej's Guide to Network Programming, which has some similar information too. Recommended reading. Thanks, Mike!

这篇关于何时使用混合IP符号:: ffff:192.168.1.4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆