examples

Class TelnetClientExample

public class TelnetClientExample extends Object implements Runnable, TelnetNotificationHandler

This is a simple example of use of TelnetClient. An external option handler (SimpleTelnetOptionHandler) is used. Initial configuration requested by TelnetClient will be: WILL ECHO, WILL SUPPRESS-GA, DO SUPPRESS-GA. VT100 terminal type will be subnegotiated.

Also, use of the sendAYT(), getLocalOptionState(), getRemoteOptionState() is demonstrated. When connected, type AYT to send an AYT command to the server and see the result. Type OPT to see a report of the state of the first 25 options.

Author: Bruno D'Avanzo

Method Summary
static voidmain(String[] args)
Main for the TelnetClientExample.
voidreceivedNegotiation(int negotiation_code, int option_code)
Callback method called when TelnetClient receives an option negotiation command.
voidrun()
Reader thread.

Method Detail

main

public static void main(String[] args)
Main for the TelnetClientExample.

receivedNegotiation

public void receivedNegotiation(int negotiation_code, int option_code)
Callback method called when TelnetClient receives an option negotiation command.

Parameters: negotiation_code - type of negotiation command received (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)

option_code - code of the option negotiated

run

public void run()
Reader thread. Reads lines from the TelnetClient and echoes them on the screen.