Read serial buffer

Hi,

I’m debugging an application that connect to a USB-Serial Device.
I can connect to the device using /dev/ttyUSB0

In the application, it have a read loop which will continuously read the receive buffer using InputStream. If the buffer is not empty then it will copy the received buffer content to another buffer, and when empty it will break the read loop and close the port.

The problem is when the first time the application read the buffer it will have some data, then after we copy the data, the application will read the buffer again. This time the buffer should be empty, and break the read loop. But the application just hang there.

The code works well if i use a serial device, but when i use the USB-Serial device it doesn’t work. Any idea how to fix this?

I’m using Linux Suse v10, and java language. I think the kernel version is 2.6