FileDocCategorySizeDatePackage
lookForLocalUDPPorts.javaAPI DocExample539Thu Apr 03 15:25:28 BST 1997None

lookForLocalUDPPorts

public class lookForLocalUDPPorts extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    
    DatagramSocket theServer;

    for (int i = 1024; i <= 65535; i++) {
      try {
        // the next line will fail and drop into the catch block if
        // there is already a server running on port i
        theServer = new DatagramSocket(i);
        theServer.close();
      }
      catch (SocketException e) {
        System.out.println("There is a server on port " + i + ".");
      } // end try
    } // end for