FileDocCategorySizeDatePackage
NamedPortLister.javaAPI DocExample760Sun Mar 28 19:09:36 BST 1999None

NamedPortLister

public class NamedPortLister extends Object

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


    // list serial (COM) ports
    try {
      int portNumber = 1;
      while (true) {
        CommPortIdentifier.getPortIdentifier("COM" + portNumber);
        System.out.println("COM" + portNumber);
        portNumber++;
      }
    }
    catch (NoSuchPortException e) {
      // break out of loop
    }

    // list parallel (LPT) ports
    try {
      int portNumber = 1;
      while (true) {
        CommPortIdentifier.getPortIdentifier("LPT" + portNumber);
        System.out.println("LPT" + portNumber);
        portNumber++;
      }
    }
    catch (NoSuchPortException e) {
      // break out of loop
    }