Example usage for org.apache.commons.net.telnet TelnetClient registerNotifHandler

List of usage examples for org.apache.commons.net.telnet TelnetClient registerNotifHandler

Introduction

In this page you can find the example usage for org.apache.commons.net.telnet TelnetClient registerNotifHandler.

Prototype

@Override
public void registerNotifHandler(TelnetNotificationHandler notifhand) 

Source Link

Document

Registers a notification handler to which will be sent notifications of received telnet option negotiation commands.

Usage

From source file:com.kz.pipeCutter.MyTelnetClient.java

public TelnetClient getTelnetClient() {

    if (tc == null) {
        TelnetClient tc1 = new TelnetClient();

        TerminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler("VT100", false, false, true, false);
        EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true, false);
        SuppressGAOptionHandler gaopt = new SuppressGAOptionHandler(true, true, true, true);

        try {//from w w w.j a  va  2s  .co  m
            tc1.addOptionHandler(ttopt);
            tc1.addOptionHandler(echoopt);
            tc1.addOptionHandler(gaopt);
        } catch (InvalidTelnetOptionException e) {
            System.err.println("Error registering option handlers: " + e.getMessage());
        }

        boolean end_loop = false;
        try {
            //tc1.setDefaultTimeout(4);
            tc1.connect(SmoothieUploader.smoothieIP, this.remotePort);
            tc1.registerNotifHandler(this);
            tc = tc1;
        } catch (IOException e) {
            System.err.println("Exception while connecting to: " + this.ipAddress + ":" + this.remotePort + "\n"
                    + e.getMessage());
        }

    }
    return tc;
}