What steps will reproduce the problem?
1. establish connection to serial device
2. write some bytes
3. read from it
4. go back to step two 30-40 times until stop working without any exception
What is the expected output? What do you see instead?
write and read infinitely
What version of the product are you using? On what operating system?
JSSC v 2.8, x64. 64 windows 7, JDK1.7_u45_x64.
Please provide any additional information below.
Here is my code:
BluetoothHandler device = new BluetoothHandler("COM3");
byte[] msg = new byte[3];
msg[0] = (byte) 0x0d;
msg[1] = (byte) 0x31;
msg[2] = (byte) 0x0d;
int i = 0;
device.connect();
Thread.sleep(2000);
while(true){
System.out.println(i);
i++;
device.sendBytes(msg);
Thread.sleep(200);
byte[] buffer = device.readBytes(5);
String textoLido = new String(buffer);
System.out.println(textoLido);
Thread.sleep(1000);
if(i > 10){
device.disconnect();
Thread.sleep(2000);
device.connect();
i = 0;
}
}
Original issue reported on code.google.com by
edneydas...@gmail.comon 16 Nov 2014 at 11:44