import java.io.InputStream;
import java.io.OutputStream;
import javax.comm.*;
public class exp {
public static void main(String args[]) throws Exception
{
for(int i=1;i<=255;i++)
{
try
{
CommPortIdentifier
cm=CommPortIdentifier.getPortIdentifier("COM"+i);
//checks if port is not used and is serial port
if(cm.isCurrentlyOwned()==false &&
cm.getPortType()==cm.PORT_SERIAL)
{
CommPort cp=cm.open("Connection", 0);
System.out.println("Present at COM"+i);
cp.close();
}
}
catch(Exception e)
{
// System.out.println("Exception");
}
}
}
}
This is working fine. Sorry I am very impatient. I am just posting
wherever I am getting stuck. From now on I will study it and then
post. Thank you.
This is faster than JavaComm.jar as it is not caring who hold the port
and trying to work at default baud rate.
--
You received this message because you are subscribed to the Google Groups
"SMSLib User Group" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/smslib?hl=en.