2

I'm working on a program on android which should update itself when there is a new version. I use the class HttpUrlConnection to connnect to the server, and then I get the inputstream of the connection. I put inputstream.read(byte[] buffer) in a loop in a thread surrounded by try & catch.

When I disconnected the wifi (not turn off), the IOException was thrown out. However, if I disconnect the router from the network, inputstream.read(byte[] buffer) was blocked without any exception thrown out. It remains blocked without timeout.

How to unblock the read() method to inform the client that he is disconnected form the network?

Any solution or hints will be greatly appreciated.

dumidy
  • 21
  • 2

0 Answers0