public void run() {
super.run();
while (!isInterrupted()) {
int size;
try {
byte[] reBuf = new byte[1024];
if (mInputStream == null) return;
size = mInputStream.read(reBuf);
if (size > 0)
onDataReceived(reBuf, size);
} catch (IOException e) {
e.printStackTrace();
try {
mInputStream.close();
mInputStream.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
如果收到的字节数小于32,那么一切都很好。但是,如果接收的字节数超过32,那么它将被中断两次。我正在Android上编写modbus。无论收到多长时间,我怎样才能获得一次中断?