SSH Factory

com.jscape.inet.telnet
Class TelnetAdapter

java.lang.Object
  extended by com.jscape.inet.telnet.TelnetAdapter
All Implemented Interfaces:
TelnetListener
Direct Known Subclasses:
TelnetTask

public class TelnetAdapter
extends java.lang.Object
implements TelnetListener

Implements methods for capturing events sourced from Telnet class. Typicaly your application will implement this interface to capture the following events :

TelnetConnectedEvent
TelnetDisconnectedEvent
DoOptionEvent
DontOptionEvent
WillOptionEvent
WontOptionEvent
DoSubOptionEvent
TelnetDataReceivedEvent

In addition to extending this class your application should register itself as an EventListener which may look somewhat like this:

 public class Application ... extends TelnetAdapter
 {
  ...
  public ... initMethod(...)
  {
    Telnet telnet = new Telnet("myserver.com");
    telnet.addTelnetListener(this);
  }
  ...
 }
 


Constructor Summary
TelnetAdapter()
           
 
Method Summary
 void connected(TelnetConnectedEvent event)
          Invoked when Telnet connection is established.
 void dataReceived(TelnetDataReceivedEvent event)
          Invoked when data is received from Telnet server.
 void disconnected(TelnetDisconnectedEvent event)
          Invoked when Telnet connection is released.
 void dontOption(DontOptionEvent event)
          Invoked when a DONT OPTION (refuse client request to use option) command is received from the Telnet server.
 void doOption(DoOptionEvent event)
          Invoked when a DO OPTION (request client to use option) command is received from the Telnet server.
 void doSubOption(DoSubOptionEvent event)
          Invoked when SB OPTION (subnegotiation) command is received from Telnet server, typically after accepting a WILL OPTION (offer client to use option) command from Telnet server.
 void willOption(WillOptionEvent event)
          Invoked when a WILL OPTION (offer client to use option) command is received from the Telnet server.
 void wontOption(WontOptionEvent event)
          Invoked when a WONT OPTION (refuse clients offer to use option) command is received from the Telnet server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TelnetAdapter

public TelnetAdapter()
Method Detail

connected

public void connected(TelnetConnectedEvent event)
Invoked when Telnet connection is established. Option negotiation has not yet been completed at this point.

Specified by:
connected in interface TelnetListener
Parameters:
event - a TelnetConnectedEvent
See Also:
TelnetConnectedEvent, Telnet.connect()

disconnected

public void disconnected(TelnetDisconnectedEvent event)
Invoked when Telnet connection is released. Disconnect can occur in many circumstances including IOException during socket read/write or manually invoking the Telnet#disconnect method

Specified by:
disconnected in interface TelnetListener
Parameters:
event - a TelnetDisconnectedEvent
See Also:
TelnetDisconnectedEvent, Telnet.disconnect()

doOption

public void doOption(DoOptionEvent event)
Invoked when a DO OPTION (request client to use option) command is received from the Telnet server. Upon receiving DoOptionEvent invoke the Telnet#sendDontOption to refuse the option or Telnet#sentWillOption to accept the option.

Specified by:
doOption in interface TelnetListener
Parameters:
event - a DoOptionEvent
See Also:
DoOptionEvent, TelnetOption, Telnet.sendDontOption(com.jscape.inet.telnet.TelnetOption), Telnet.sendWillOption(com.jscape.inet.telnet.TelnetOption)

dontOption

public void dontOption(DontOptionEvent event)
Invoked when a DONT OPTION (refuse client request to use option) command is received from the Telnet server.

Specified by:
dontOption in interface TelnetListener
Parameters:
event - a DontOptionEvent
See Also:
DontOptionEvent, TelnetOption

willOption

public void willOption(WillOptionEvent event)
Invoked when a WILL OPTION (offer client to use option) command is received from the Telnet server. Upon receiving WillOptionEvent invoke the Telnet#sendDontOption method to refuse the option or Telnet#sendDoOption method to accept the option.

Specified by:
willOption in interface TelnetListener
Parameters:
event - a WillOptionEvent
See Also:
WillOptionEvent, TelnetOption, Telnet.sendDoOption(com.jscape.inet.telnet.TelnetOption), Telnet.sendDontOption(com.jscape.inet.telnet.TelnetOption)

wontOption

public void wontOption(WontOptionEvent event)
Invoked when a WONT OPTION (refuse clients offer to use option) command is received from the Telnet server.

Specified by:
wontOption in interface TelnetListener
Parameters:
event - a WontOptionEvent
See Also:
WontOptionEvent, TelnetOption

doSubOption

public void doSubOption(DoSubOptionEvent event)
Invoked when SB OPTION (subnegotiation) command is received from Telnet server, typically after accepting a WILL OPTION (offer client to use option) command from Telnet server. Upon receiving DoSupOptionEvent invoke the Telnet#sendOptionSubnegotiation to perform subnegotiation for the requested option.

Specified by:
doSubOption in interface TelnetListener
Parameters:
event - a DoSubOptionEvent
See Also:
DoSubOptionEvent, Telnet.sendOptionSubnegotiation(com.jscape.inet.telnet.TelnetOption)

dataReceived

public void dataReceived(TelnetDataReceivedEvent event)
Invoked when data is received from Telnet server.

Specified by:
dataReceived in interface TelnetListener
Parameters:
event - a TelnetDataReceivedEvent
See Also:
TelnetDataReceivedEvent

SSH Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved