Class TelnetClient

The TelnetClient class implements the simple network virtual
terminal (NVT) for the Telnet protocol according to RFC 854. It
does not implement any of the extra Telnet options because it
is meant to be used within a Java program providing automated
access to Telnet accessible resources.

The class can be used by first connecting to a server using the
SocketClient
connect
method. Then an InputStream and OutputStream for sending and
receiving data over the Telnet connection can be obtained by
using the getInputStream() and
getOutputStream() methods.
When you finish using the streams, you must call
disconnect rather than simply
closing the streams.

disconnect

Disconnects the telnet session, closing the input and output streams
as well as the socket. If you have references to the
input and output streams of the telnet connection, you should not
close them yourself, but rather call disconnect to properly close
the connection.

unregisterNotifHandler

setReaderThread

When enabled, a seaparate internal reader thread is created for new
connections to read incoming data as it arrives. This results in
immediate handling of option negotiation, notifications, etc.
(at least until the fixed-size internal buffer fills up).
Otherwise, no thread is created an all negotiation and option
handling is deferred until a read() is performed on the
input stream.

registerInputListener

Register a listener to be notified when new incoming data is
available to be read on the input stream.
Only one listener is supported at a time.

More precisely, notifications are issued whenever the number of
bytes available for immediate reading (i.e., the value returned
by InputStream.available()) transitions from zero to non-zero.
Note that (in general) multiple reads may be required to empty the
buffer and reset this notification, because incoming bytes are being
added to the internal buffer asynchronously.

Notifications are only supported when a reader thread is enabled for the connection.