• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Communication API

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am facing a problem with the code below
System.out.println("Found port: "+portId.getName());
System.out.println("Currently Owned : " + portId.isCurrentlyOwned() + "\nOwned By : " + portId.getCurrentOwner());
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
} catch (PortInUseException e) { System.out.println(e + "\n Port Owner is : " + e.currentOwner);}
the output is as follows:
Found port: /dev/cua/a
Currently Owned : false
Owned By : Port currently not owned
javax.comm.PortInUseException: Port currently owned by another application, or cannot be accessed
Port Owner is : another application, or cannot be accessed
As you can see in the output when I check the port with isCurrentlyOwned() method it returns false which means that the port is not used. But when i try to open the port with open() method. It throws an exception. What could be the reason. I am running this code in Sun Solaris 9 and JDK 1.4.1_04
It is very urgent. Please help me.
Thanks in advance,
Prabahar
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic