We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f4a04c7 commit e41dfd3Copy full SHA for e41dfd3
1 file changed
Port Scanner.java
@@ -0,0 +1,16 @@
1
+import java.net.*;
2
+
3
+public class PortScanner {
4
+ public static void main(String[] args) {
5
+ String host = "localhost";
6
7
+ for (int port = 1; port <= 1000; port++) {
8
+ try {
9
+ Socket s = new Socket();
10
+ s.connect(new InetSocketAddress(host, port), 50);
11
+ System.out.println("Open: " + port);
12
+ s.close();
13
+ } catch (Exception e) {}
14
+ }
15
16
+}
0 commit comments