java I/O is blocked while reading on socket when i put off the battery from device.
Posted
by gunjan goyal
on Stack Overflow
See other posts from Stack Overflow
or by gunjan goyal
Published on 2010-06-11T04:47:55Z
Indexed on
2010/06/11
4:52 UTC
Read the original article
Hit count: 366
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
© Stack Overflow or respective owner