org.apache.commons.net.telnet
public class TelnetClient extends Telnet
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.
Field Summary | |
---|---|
protected boolean | readerThread |
Constructor Summary | |
---|---|
TelnetClient()
Default TelnetClient constructor.
| |
TelnetClient(String termtype) |
Method Summary | |
---|---|
InputStream | getInputStream()
Returns the telnet connection input stream. |
boolean | getLocalOptionState(int option)
Returns the state of the option on the local side.
|
OutputStream | getOutputStream()
Returns the telnet connection output stream. |
boolean | getReaderThread()
Gets the status of the reader thread.
|
boolean | getRemoteOptionState(int option)
Returns the state of the option on the remote side.
|
void | registerSpyStream(OutputStream spystream)
Registers an OutputStream for spying what's going on in
the TelnetClient session.
|
boolean | sendAYT(long timeout)
Sends an Are You There sequence and waits for the result.
|
void | setReaderThread(boolean flag)
Sets the status of the reader thread.
|
void | stopSpyStream()
Stops spying this TelnetClient.
|
disconnect
.
Returns: The telnet connection input stream.
Parameters: option - Option to be checked.
Returns: The state of the option on the local side.
disconnect
.
Returns: The telnet connection output stream.
Returns: true if the reader thread is on, false otherwise
Parameters: option - Option to be checked.
Returns: The state of the option on the remote side.
Parameters: spystream - OutputStream on which session activity will be echoed.
Parameters: timeout - Time to wait for a response (millis.)
Returns: true if AYT received a response, false otherwise
Throws: InterruptedException IllegalArgumentException IOException
Parameters: flag - true switches the reader thread on, false switches it off