Question

My Java-Program is having trouble to communicate correctly over one serial port. In fact, there are two serial ports on the computer and the program manages two thread. Each thread is using one different serial port. One thread has trouble to send over the port. The bytes are not sent after using OutputStream.write() but after the java.io.OutputStream.flush() method has been used. And the thread gets "stuck" from 5 to 10 minutes on the flush() method. The other thread is working the same way but has absolutely no trouble. The outputstream instance comes from gnu.io.CommPort.getOutputStream().

Does anyone has an idea why the thread doesn't send bytes immediately but only after being stuck 5 minutes on the flush() method and what I should do differently ?

Was it helpful?

Solution

I finally found out what the source of the problem was. The serial port was defect. I replaced it and it works fine now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top