| |
|
| org.apache.commons.net.telnet.Telnet org.apache.commons.net.telnet.TelnetClient
All known Subclasses: org.apache.commons.net.ftp.FTP,
TelnetClient | public class TelnetClient extends Telnet (Code) | | 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
org.apache.commons.net.SocketClient.connect connect method. Then an InputStream and OutputStream for sending and
receiving data over the Telnet connection can be obtained by
using the
TelnetClient.getInputStream getInputStream() and
TelnetClient.getOutputStream getOutputStream() methods.
When you finish using the streams, you must call
TelnetClient.disconnect disconnect rather than simply
closing the streams.
author: Daniel F. Savarese author: Bruno D'Avanzo |
readerThread | protected boolean readerThread(Code) | | |
TelnetClient | public TelnetClient()(Code) | | Default TelnetClient constructor.
|
_connectAction_ | protected void _connectAction_() throws IOException(Code) | | Handles special connection requirements.
exception: IOException - If an error occurs during connection setup. |
disconnect | public void disconnect() throws IOException(Code) | | 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.
|
getInputStream | public InputStream getInputStream()(Code) | | Returns the telnet connection input stream. You should not close the
stream when you finish with it. Rather, you should call
TelnetClient.disconnect disconnect .
The telnet connection input stream. |
getLocalOptionState | public boolean getLocalOptionState(int option)(Code) | | Returns the state of the option on the local side.
Parameters: option - - Option to be checked. The state of the option on the local side. |
getOutputStream | public OutputStream getOutputStream()(Code) | | Returns the telnet connection output stream. You should not close the
stream when you finish with it. Rather, you should call
TelnetClient.disconnect disconnect .
The telnet connection output stream. |
getReaderThread | public boolean getReaderThread()(Code) | | Gets the status of the reader thread.
true if the reader thread is on, false otherwise |
getRemoteOptionState | public boolean getRemoteOptionState(int option)(Code) | | Returns the state of the option on the remote side.
Parameters: option - - Option to be checked. The state of the option on the remote side. |
registerNotifHandler | public void registerNotifHandler(TelnetNotificationHandler notifhand)(Code) | | Registers a notification handler to which will be sent
notifications of received telnet option negotiation commands.
Parameters: notifhand - - TelnetNotificationHandler to be registered |
registerSpyStream | public void registerSpyStream(OutputStream spystream)(Code) | | Registers an OutputStream for spying what's going on in
the TelnetClient session.
Parameters: spystream - - OutputStream on which session activitywill be echoed. |
setReaderThread | public void setReaderThread(boolean flag)(Code) | | Sets the status of the reader thread.
The reader thread status will apply to all subsequent connections
Parameters: flag - - true switches the reader thread on, false switches it off |
stopSpyStream | public void stopSpyStream()(Code) | | Stops spying this TelnetClient.
|
unregisterNotifHandler | public void unregisterNotifHandler()(Code) | | Unregisters the current notification handler.
|
|
|
|