Client.available() has a strange behavior
in
Core Library Questions
•
1 year ago
Hi all,
I have a Processing program that talks via a network socket to veejay, a vjing software.
I noticed a strange behavior with Client.available().
The idea is that my method timeouts if the bytes are not received within 200ms.
While my dev computer (an i686 running linux) behaves correctly, the two other computers (two x86_64 running linux, ubuntu or archlinux) show me mesages like:
I have a Processing program that talks via a network socket to veejay, a vjing software.
I noticed a strange behavior with Client.available().
The idea is that my method timeouts if the bytes are not received within 200ms.
While my dev computer (an i686 running linux) behaves correctly, the two other computers (two x86_64 running linux, ubuntu or archlinux) show me mesages like:
- timed out while waiting for bytes (1008/8)
- public byte[] read_control(int numtoread) {
- // vims_control is a Client bound to 127.0.0.1:3490
- byte answer[] = new byte[numtoread];
- int timeout = parent.millis() + 200;
- while(vims_control.available() < numtoread) {
- if(parent.millis() > timeout) {
- parent.println("timed out while waiting for bytes ("
- + vims_control.available() + "/"
- + numtoread + ")");
- break;
- }
- };
- vims_control.readBytes(answer);
- return answer;
- }
I'm not sure the problem lies in Processing or Java. So any idea about where to check or how to do this properly is welcome.
Can it be there's some kind of buffering at the java or system level ?
Thanks,
Charlot
Can it be there's some kind of buffering at the java or system level ?
Thanks,
Charlot
1