• 周四. 10 月 3rd, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

一个测ip和端口是否联通的工具类

admin

11 月 28, 2021

public class TestIp {
public static void main(String[] args) {
Socket connect = new Socket();

try {
connect.connect(new InetSocketAddress(“192.168.0.59”, 8071),100);

boolean res = connect.isConnected();
System.out.println(“” + res);
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
connect.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

发表回复