Apache SubnetInfo 用于环回地址
使用 Apache Commons Net 库,为什么以下输出 CIDR 表示法 127.0.0.1/32 的 0 地址?我早就料到会有这样的结果,还是我误解了什么?地址127.0.0.1不在指定范围内吗?
SubnetInfo rangeInfo = new SubnetUtils("127.0.0.1/32").getInfo();
System.out.println(rangeInfo.getAddressCount());
Using the Apache Commons Net library, why does the following output 0 addresses for the CIDR notation 127.0.0.1/32 ? I'd have expected one, or am I misunderstanding something? Is the address 127.0.0.1 not in the specified range?
SubnetInfo rangeInfo = new SubnetUtils("127.0.0.1/32").getInfo();
System.out.println(rangeInfo.getAddressCount());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有测试过,但似乎变量
rangeInfo
尚未设置。如果这只是一个拼写错误,这可能会为您提供正确的主机数量。I haven't tested it yet, but it appears that the variable
rangeInfo
is not set. If that is just a typo, this may get you the correct number of hosts.