nyholku / purejavacomm

Pure Java implementation of JavaComm SerialPort
http://www.sparetimelabs.com/purejavacomm/index.html
BSD 3-Clause "New" or "Revised" License
362 stars 146 forks source link

IO Exception while reading data from SerialPort #97

Open nvvsatya2003 opened 7 years ago

nvvsatya2003 commented 7 years ago

Received event. Type: 1 [ERROR] , IO Exception java.io.IOException at purejavacomm.PureJavaSerialPort$2.read(PureJavaSerialPort.java:864) at java.io.InputStream.read(Unknown Source) at com.gui.SerialPortCommunication.serialEvent(SerialPortCommunication.java:232) at purejavacomm.PureJavaSerialPort.sendDataEvents(PureJavaSerialPort.java:96) at purejavacomm.PureJavaSerialPort.access$28(PureJavaSerialPort.java:93) at purejavacomm.PureJavaSerialPort$3.run(PureJavaSerialPort.java:1217) at java.lang.Thread.run(Unknown Source) CLOSING THE PORT COM3 COM3 Port Connected.

Hi , i am getting the event as 1 (i know it means data is available), and then while trying to read the same data from serial-port it is throwing exception like above. can you guys please help me to understand the issue,.. thanks in advance.

derikd commented 7 years ago

Is it possible you have 2 serial monitors? Why does you code say that the com port 3 was closed and then reopened immediately after the thread trace? Is that part of your error handling routine that was executed AFTER the exception occurred? Or is it possible that happened first, and the exception trace just printed to StdErr first?

On Feb 20, 2017, at 1:02 AM, nvvsatya2003 notifications@github.com<mailto:notifications@github.com> wrote:

Received event. Type: 1 [ERROR] , IO Exception java.io.IOException at purejavacomm.PureJavaSerialPort$2.read(PureJavaSerialPort.java:864) at java.io.InputStream.read(Unknown Source) at com.gui.SerialPortCommunication.serialEvent(SerialPortCommunication.java:232) at purejavacomm.PureJavaSerialPort.sendDataEvents(PureJavaSerialPort.java:96) at purejavacomm.PureJavaSerialPort.access$28(PureJavaSerialPort.java:93) at purejavacomm.PureJavaSerialPort$3.run(PureJavaSerialPort.java:1217) at java.lang.Thread.run(Unknown Source) CLOSING THE PORT COM3 COM3 Port Connected.

Hi , i am getting the event as 1 (i know it means data is available), and then while trying to read the same data from serial-port it is throwing exception like above. can you guys please help me to understand the issue,.. thanks in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nyholku/purejavacomm/issues/97, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AOMXDwpDc8_S_Zd7DrZcZhpv7qJIXyqMks5reVafgaJpZM4MF6jp.

nvvsatya2003 commented 7 years ago

HI derikd , thanks for your response... Yes,, whenever the exception came i am closing the serialport and reopen again, then it is working as expected (data flow will be normal), But i want to know why the exception is getting , when i try to read the data from serialport. even i got the event as 1.

derikd commented 7 years ago

did you ever make progress on this bug? did you ever find something closing your port? Or some other thread reading data from the port?