Port Finder : CommPortIdentifier « Development « Java Tutorial






import java.io.*;
import javax.comm.*;
import java.util.*;

public class Main
{    
    public static void main(String[] args)
    {
        Enumeration ports = CommPortIdentifier.getPortIdentifiers();
        
        while(ports.hasMoreElements())
        {
            CommPortIdentifier cpi =
                           (CommPortIdentifier)ports.nextElement();
            System.out.println("Port " + cpi.getName());
        }
    }
}








6.53.CommPortIdentifier
6.53.1.Port Finder
6.53.2.Port Reader
6.53.3.Port Sniffer
6.53.4.Port Writer