IPv6地址的文本表示的最大长度? [英] Maximum length of the textual representation of an IPv6 address?
问题描述
我想将PHP中的 $ _ SERVER [REMOTE_ADDR]
返回的数据存储到一个数据库字段中,非常简单的任务,真的。问题是我找不到任何有关IPv6地址的文本表示的最大长度的正确信息,这是网络服务器通过 $ _ SERVER [REMOTE_ADDR ]
。
我不想将文本表示转换为地址通常编码的128位,我只想知道需要多少字符来存储任何解决方案
由 $ _ SERVER [REMOTE_ADDR]
8 * 4 + 7 = 39
8组4位数,其中7':'。
或者,如果您想考虑IPv4隧道功能[ 0000:0000:0000:0000:0000:0000:192.168.0.1],
(6 * 4 + 5)+ 1 + 4 * 3 + 3)= 29 + 1 + 15 = 45
I want to store the data returned by $_SERVER["REMOTE_ADDR"]
in PHP into a DB field, pretty simple task, really. The problem is that I can't find any proper information about the maximum length of the textual representation of an IPv6 address, which is what a webserver provides through $_SERVER["REMOTE_ADDR"]
.
I'm not interested in converting the textual representation into the 128 bits the address is usually encoded in, I just want to know how many characters maximum are needed to store any IPv6 address returned by $_SERVER["REMOTE_ADDR"]
.
I believe it would be:
8 * 4 + 7 = 39
8 groups of 4 digits with 7 ':' between them.
Or, if you want to take into account the IPv4 tunneling features [0000:0000:0000:0000:0000:0000:192.168.0.1],
(6 * 4 + 5) + 1 + (4 * 3 + 3) = 29 + 1 + 15 = 45
这篇关于IPv6地址的文本表示的最大长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!