In my application I use socket to communication with another device how I can check if inputStream
is empty
? In this line I have a
java.net.SocketTimeoutException
while ((bytesRead = inputStream.read(content)) != -1) {
In my application I use socket to communication with another device how I can check if inputStream
is empty
? In this line I have a
java.net.SocketTimeoutException
while ((bytesRead = inputStream.read(content)) != -1) {
Try inputstream.available()
. It returns an estimate of the number of bytes that can be read from this input stream without blocking by the next invocation of a method for this input stream.