commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [net] Detect server disconnect
Date Tue, 25 Dec 2012 20:01:10 GMT
You'll likely catch an IOException.

Gary

On Dec 25, 2012, at 14:02, Krijn Schaap <krijnschaap@gmail.com> wrote:

> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message