Scan your computer for ports in use : Utilities « Network Protocol « Java






Scan your computer for ports in use

Scan your computer for ports in use
     
import java.net.ServerSocket;

public class LocalScan {
  public static void main(String[] args) {
    for (int i = 1; i < 1023; i++) {
      testPort(i);
    }
    System.out.println("Completed");
  }

  private static void testPort(int i) {
    try {
      ServerSocket sock = new ServerSocket(i);
    } catch (java.io.IOException e) {
      System.out.println("Port " + i + " in use.");
    }
  }
}
           
         
    
    
    
    
  








Related examples in the same category

1.A class that encodes URL parameter values for MIDP devices.
2.Get the listing of everyone logged on
3.Using the URL Class (GetURL.java)
4.TCP socket monitor
5.Create Socket helper
6.Implements a TCP/IP bounce utility (proxy)
7.URL utilities class that makes it easy to create new URLs based off of old URLs without having to assemble or parse them yourself
8.Download from URL
9.URL ParserURL Parser
10.A simple class to load an URL in a browser
11.Using the java API URL class, extract the http/https hostname.
12.Utility class for URL decoding.
13.Utility class for URL encoding.
14.Allows easy downloading of files from HTTP sites
15.enum Http Status