954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

javax.comm write error

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

cosi
Junior Poster
153 posts since Aug 2004
Reputation Points: 17
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You