gpt4 book ai didi

Java api 查找网络节点

转载 作者:太空宇宙 更新时间:2023-11-04 08:43:11 25 4
gpt4 key购买 nike

如何在Java中查找所有本地网络节点?

问候,

奇拉格

最佳答案

您可能正在寻找this

public void checkHosts(String subnet){
int timeout=1000;
for (int i=1;i<254;i++){
String host=subnet + "." + i;
if (InetAddress.getByName(host).isReachable(timeout)){
System.out.println(host + " is reachable");
}
}
}

关于Java api 查找网络节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4862217/

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