I am using a BufferedInputStream
to read from a socket. The BufferedInputStream
reads as follows:
socketInput.read(replyBuffer, 0, 7);
It is instantiated by
socketInput = new BufferedInputStream(mySocket.getInputStream());
mySocket
is defined as private Socket mySocket;
mySocket
is instantiated by mySocket = new Socket(ipAddress, port);
I have verified that mySocket
is connected to my device. I can send data to my device; however, I am not receiving from my device for unknown reasons but that is not the problem.
I want my BufferedInputStream
to return after say 100ms if it does not read any data. Can the BufferedInputStream
be setup to do this? Right now, it blocks indefinitely.
java.nio
) classes, not stuff injava.io
. – Jaguar