java I/O is blocked while reading on socket when i put off the battery from device.
- by gunjan goyal
hi,
i m working on client socket connection.
client is a GPRS hardware device.
i m receiving request from this client on my serversocket and then opening multiple threads.
my problem is that when device/client close the socket then my IO detects that throws an exception but when i put off the battery from the device while sending the request to the serversocket it is blocked without throwing any exception.
please help me out. thanks in advance.
this is my code.
try {
while ((len = inputStream.read(mainBuffer)) -1) {
System.out.println("len= " + len);
}//end of while
System.out.println("out of while loop");//which is never printed on screen.
} catch (IOException e) {
e.printStackTrace();
}
regards
gunjan goyal