Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## examples.telnet
Class TelnetClientExample

    java.lang.Object
      examples.telnet.TelnetClientExample

All Implemented Interfaces:
  Runnable, TelnetNotificationHandler

    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

Field Summary

Fields inherited from interface org.apache.commons.net.telnet.TelnetNotificationHandler
`RECEIVED_COMMAND, RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT`

Constructor Summary
`TelnetClientExample()`

Method Summary
`static void` | `main(String[] args)` Main for the TelnetClientExample.
`void` | `receivedNegotiation(int negotiation_code, int option_code)` Callback method called when TelnetClient receives an option negotiation command.
`void` | `run()` Reader thread.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TelnetClientExample

    public TelnetClientExample()

Method Detail

### main

    public static void main(String[] args)
                     throws IOException

  Main for the TelnetClientExample.

  Throws:
    `IOException`

### receivedNegotiation

    public void receivedNegotiation(int negotiation_code,
                                    int option_code)

  Callback method called when TelnetClient receives an option negotiation command.

  Specified by:
    `receivedNegotiation` in interface `TelnetNotificationHandler`
  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.

  Specified by:
    `run` in interface `Runnable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.