I encountered an interesting problem: when calling the readArray(b, off, Minimum) method, which is called exclusively inside your code(namely RTXTPort#1492), the result is 0(Minimum = 1). The b parameter is not empty, the bytes are readable. Presumably the problem may also be caused by the int a = nativeavailable();(RTXTPort#1467) method, which returns 0, which is why Minimum = 1.
Important note, the problem is not static, i.e. it is periodic, sometimes it can read normally, and sometimes the problem pops and it can freeze for a few minutes up.
My code:
byte[] buffer = new byte[4096];
inputStream = serialPort.getInputStream();
while (!isInterrupted())
{
// problem is here, it returns 0 sometimes ->
int bytesRead = inputStream.read(buffer); //#RTXTPort inputStream
if (bytesRead == -1)
break;
..........
Thread.currentThread().sleep(500);
I encountered an interesting problem: when calling the
readArray(b, off, Minimum)
method, which is called exclusively inside your code(namely RTXTPort#1492), the result is 0(Minimum = 1). The b parameter is not empty, the bytes are readable. Presumably the problem may also be caused by theint a = nativeavailable();
(RTXTPort#1467) method, which returns 0, which is why Minimum = 1.Important note, the problem is not static, i.e. it is periodic, sometimes it can read normally, and sometimes the problem pops and it can freeze for a few minutes up.
My code:
What the problem is and whether it's yours?