gpt4 book ai didi

java - getNetworkPrefixLength() 返回奇怪的子网掩码

转载 作者:行者123 更新时间:2023-12-02 08:42:19 25 4
gpt4 key购买 nike

以下代码:

InetAddress localHost = Inet4Address.getLocalHost();
NetworkInterface networkInterface = NetworkInterface.getByInetAddress(localHost);

for (InterfaceAddress address : networkInterface.getInterfaceAddresses()) {
System.out.println(address.getAddress() + "/" + address.getNetworkPrefixLength());
}

返回:

/fe80:0:0:0:11da:433a:412a:8c23%13/64
/192.168.1.107/128

我的子网掩码是/24,而不是/128。这是 Java 错误吗?

最佳答案

也许您遇到了这个错误:http://bugs.sun.com/view_bug.do?bug_id=6707289

(请停止投票......这只有 1 个谷歌距离......)

关于java - getNetworkPrefixLength() 返回奇怪的子网掩码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6665808/

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