commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krijn Schaap <krijnsch...@gmail.com>
Subject [net] Detect server disconnect
Date Tue, 25 Dec 2012 16:06:47 GMT
Hello,

I am using the TelnetClient using the threaded reader, and read from the input stream upon
notification of the TelnetInputListener:

        public void telnetInputAvailable() {
			InputStream input = telnetClient.getInputStream();
			try {
				byte[] data = new byte[input.available()];
				input.read(data, 0, data.length);
				System.out.print(new String(data));
			} catch(IOException e) {
				e.printStackTrace();
			}
        }

However, I would like to detect when the client gets disconnected from the server (forced
disconnect, by timeouts etc). How can I best do this?

Thanks
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message