ezbins / java-simple-serial-connector

Automatically exported from code.google.com/p/java-simple-serial-connector
0 stars 0 forks source link

jssc stops working after a while on windows 7 #75

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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.com on 16 Nov 2014 at 11:44

GoogleCodeExporter commented 8 years ago
have observed similar

running send/receive with xbee network, after indeterminate amount of time (up 
to 5 days) running it will stop receiving data on the serial port (no more 
serial events) and then after a while stop sending as well - writeBytes just 
blocks permanently.

restarting serial port (disconnect + connect) triggers massive flood of data 
that was queued up, but then problem returns after maybe 5 minutes and is no 
longer fixable using same technique.

Original comment by terry.cu...@gmail.com on 16 Feb 2015 at 11:10