gpt4 book ai didi

android - 获取 IP 地址,但在 Android 中为 xxx.xxx.xxx.xxx 格式

转载 作者:行者123 更新时间:2023-11-29 15:57:24 27 4
gpt4 key购买 nike

大家好,我已经通过大量在线编码来获取我的 android 手机 IP 地址大多数都以

结尾
if (!inetAddress.isLoopbackAddress())
{ return inetAddress.getHostAddress().toString(); }

我怎么会得到这样的东西:- "fe80::a00:27ff:fe37:28b5%eth1"奇怪,因为我期待像 xxx.xxx.xxx.xxx 这样的东西

谁能帮我理解这是什么?

最佳答案

这是一个 IPv6 地址。此外,由于它以 fe80:: 开头,您知道它也是一个 link-local IPv6 address。 ,因此不能用于本地网络以外的通信。 (在这种情况下,eth1,因为这是在 % 之后指定的范围 - 但请注意,使用 % 来标识使用 IPv6 地址时,作用域并不总是有效。)

关于android - 获取 IP 地址,但在 Android 中为 xxx.xxx.xxx.xxx 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27244114/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com