import java.net.*;
public class UDPPortScanner {
public static void main(String[] args) {
for (int port = 1024; port <= 65535; port++) {
try {
// the next line will fail and drop into the catch block if
// there is already a server running on port i
DatagramSocket server = new DatagramSocket(port);
server.close();
} catch (SocketException ex) {
System.out.println("There is a server on port " + port + ".");
}
}
}
}
Java 本机UDP端口扫描程序
最新推荐文章于 2022-12-30 14:55:04 发布