nymo1 / java-simple-serial-connector

Automatically exported from code.google.com/p/java-simple-serial-connector
0 stars 0 forks source link

serialPort in Thread #37

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
jssc 2.5.0 version on Windows 8.

When SerialPort is used in another Thread the port result closed. The openPort 
and setOptions are called into constructor (so in Main Thread). When the thread 
is running and use writeString, throws the exception 

jssc.SerialPortException: Port name - COM5; Method name - writeString(); 
Exception type - Port not opened.
    at jssc.SerialPort.checkPortOpened(SerialPort.java:855)
    at jssc.SerialPort.writeString(SerialPort.java:367)
    at net.dfware.asterisk.cdr2serial.SerialThread.run(SerialThread.java:58)
    at java.lang.Thread.run(Thread.java:722)

The code is attached. It's right? If I open the port in run() method, all work 
fine. 

Original issue reported on code.google.com by pdi...@gmail.com on 9 May 2013 at 8:13

Attachments:

GoogleCodeExporter commented 8 years ago
Hmm, it interesting. All should works, I seen your code and run it successfuly. 
See the attachement for Main.java

Can you please describe more detail this issue.

Original comment by scream3r.org@gmail.com on 10 May 2013 at 6:01

Attachments:

GoogleCodeExporter commented 8 years ago
:-(
Sorry !!! It's a my mistake. The controller thread wasn't in wait() and it 
closed the port immediatly. All work fine.

Again apologize.

Original comment by pdi...@gmail.com on 10 May 2013 at 6:57

GoogleCodeExporter commented 8 years ago
That's OK. Issue closed.

Original comment by scream3r.org@gmail.com on 10 May 2013 at 7:50