public static void main(String[] args) throws IOException {
for (int i=1; i<=1024; i++) {
try {
Socket socket = new Socket("localhost", i);
if (socket != null) {
System.out.println(i + "启动");
socket.close();
}
} catch (Exception e) {
e.printStackTrace();
//System.out.println("没有启动监听");
}
}
}
监听电脑的各端口
最新推荐文章于 2023-11-26 15:46:19 发布