I've a Socket connected to another device on my LAN. How can i detect the disconnection When i unplug the device from the AC. The thread is blocked on:
BufferedReader b=//
b.readLine();
I've a Socket connected to another device on my LAN. How can i detect the disconnection When i unplug the device from the AC. The thread is blocked on:
BufferedReader b=//
b.readLine();
If you're going to use such logic, then set a timeout on the socket (i.e. setSoTimeout(TIMEOUT_IN_MILLISECONDS)
). This will interrupt the blocking I/O operation.