cosi 4 Junior Poster

I recently bumped into this interesting problem when writing code that used serial port communications. Writing data to serial port fails after ~ 30 seconds of use. Everything works fine for the first 30 seconds or so, then an IOException: write error occurs.

I am writing data to the OutputStream a serial port configured like this:

fSerialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);

fSerialPort.setSerialPortParams(baudrate, SerialPort.DATABITS_8,
	SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

This problem is similarly described in these Sun Java Forums. However, no one seems to have a solution to this problem, and those forum threads died long ago. I hope dani's community might have some answers.

http://forum.java.sun.com/thread.jsp?thread=14240&forum=8&message=817968
http://forum.java.sun.com/thread.jsp?forum=52&thread=283214&message=1104701

Below is a snip of the output as well as the stack trace:

COMM|Sending: Ask for Embedded Status. Header: 4 0 12 8 
java.io.IOException: write error
	at com.sun.comm.Win32SerialPort.write(Win32SerialPort.java:677)
	at com.sun.comm.Win32SerialOutputStream.write(Win32SerialOutputStream.java:43)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
	at edu.dartmouth.robot.tenzing.comm.TimerSender.send(TimerSender.java:103)
	at edu.dartmouth.robot.tenzing.comm.RobotComm.run(RobotComm.java:157)

Perhaps this is a java bug that I should report, but I just want to be sure.


Ed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.