purejavacomm icon indicating copy to clipboard operation
purejavacomm copied to clipboard

IO Exception while reading data from SerialPort

Open nvvsatya2003 opened this issue 8 years ago • 3 comments

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.

nvvsatya2003 avatar Feb 20 '17 09:02 nvvsatya2003

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 <[email protected]mailto:[email protected]> 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.

derikd avatar Feb 20 '17 23:02 derikd

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.

nvvsatya2003 avatar Feb 21 '17 05:02 nvvsatya2003

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?

derikd avatar Mar 04 '17 00:03 derikd