I have written a telnet client that establishes a telnet session with the help of org.apache.commons.net.telnet.TelnetClient to the server and it monitors a particular file. It reads the latest contents written to that file using the tail -F command . The problem I am facing is that the blocking call inputStream.read(int) does not throw an exception even when the telnet server machine reboots, but When network cable is unplugged we are getting an IOException. Due to this behavior my program fails to receive the updates from the file after a machine reboot. Even the telnetClientObject.isConnected() returns true while the machine is rebooting.
Can you please suggest ways to rectify this issue?