Results 1 to 1 of 1
Thread: Comm API Usage
- 11-16-2007, 04:59 PM #1
Member
- Join Date
- Nov 2007
- Posts
- 5
- Rep Power
- 0
Comm API Usage
I am trying to write a JavaSE application using Swing to access the virtual COM port created when connecting a Modem aware device to the USB.
I can see data coming across the COM port via Hyperterminal and I want to write a hyperterminal like application to react to and filter this messaging.
I have tried using the Comm API and followed the API instructions to the letter.
I am using the following code in my JavaSE app:
{
...
private void initCommPorts() {
CommPortIdentifier portId;
Enumeration portList = CommPortIdentifier.getPortIdentifiers();
if (portList == null) {
System.out.println("portList is null");
}
else {
System.out.println(portList.toString());
}
String comPort = "";
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
System.out.print("Port found");
comPort = portId.getName();
System.out.println("Found port: " + comPort);
// Add COM port to visual object selection list
comChoice.addItem(comPort);
}
}
...
}
The issue is that this code never finds the virtual COM ports. The Enumeration is always empty.
Am I using the right API here. Can the Comm API be used to create a connection to the virtual COM ports in Windows XP?
Thanks guys - and sorry for my ignorance on this matter!
Similar Threads
-
How to determine CPU usage using Java?????
By JavaEmpires in forum New To JavaReplies: 5Last Post: 03-16-2011, 04:49 AM -
javax.comm:Error instantiating class com.sun.comm.Win32Driver
By bbq in forum Advanced JavaReplies: 7Last Post: 07-12-2010, 04:24 PM -
javax/comm/SerialPortEvent
By musiigedeo in forum Threads and SynchronizationReplies: 9Last Post: 11-24-2008, 11:07 AM -
Integer Usage
By bluegreen7hi in forum New To JavaReplies: 11Last Post: 01-24-2008, 08:54 AM -
javax.comm package for COM ports
By valery in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 03:03 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks