# Class telnet

    java.lang.Object
       |
       +----java.awt.Component
               |
               +----java.awt.Container
                       |
                       +----java.awt.Panel
                               |
                               +----java.applet.Applet
                                       |
                                       +----telnet

public class telnet
extends Applet
implements Runnable, TerminalHost, StatusPeer

A telnet implementation that supports different terminal emulations.

Version:
  $Id: telnet.java,v 1.15 1997/10/30 16:00:02 leo Exp $
Author:
  Matthias L. Jugel, Marcus Meißner

##

address
  The host address to connect to.
emulation
  Emulation type (default is vt320).
modules
  Dynamically loaded modules are stored here.
params
  This Hashtable contains information retrievable by getParameter() in case the program is run as an application and the AppletStub is missing.
port
  The port number (default ist 23).
proxy
  The proxy ip address.
proxyport
  The proxy port number.
term
  The terminal emulation (dynamically loaded).
tio
  The telnet io methods.

##

telnet()

##

connect()
  Connect to the specified host and port but don't break existing connections.
connect(String)
  Connect to the specified host and port but don't break existing connections.
connect(String, int)
  Connect to the specified host and port but don't break existing connections.
disconnect()
  Disconnect from the remote host.
getAppletInfo()
  Retrieve the current version of the applet.
getParameter(String)
  We override the Applet method getParameter() to be able to handle parameters even as application.
getParameterInfo()
  Retrieve parameter tag information.
init()
  Initialize applet.
main(String[])
  The main function is called on startup of the application.
notifyStatus(Vector)
  This method is called when telnet needs to be notified of status changes.
run()
  Try to read data from the sockets and put it on the terminal.
send(String)
  Send a String to the remote host.
start()
  Upon start of the applet try to create a new connection.
stop()
  Disconnect when the applet is stopped.

##

tio

      protected TelnetIO tio

  The telnet io methods.
  See Also:
    TelnetIO

term

      protected Terminal term

  The terminal emulation (dynamically loaded).
  See Also:
    emulation, Terminal, TerminalHost

address

      protected String address

  The host address to connect to. This is retrieved from the PARAM tag "address".

port

      protected int port

  The port number (default ist 23). This can be specified as the PARAM tag "port".

proxy

      protected String proxy

  The proxy ip address. If this variable is set telnet will try to connect to this address and then send a string to tell the relay where the target host is.
  See Also:
    address

proxyport

      protected int proxyport

  The proxy port number. This is the port where the relay is expected to listen for incoming connections.
  See Also:
    proxy, port

emulation

      protected String emulation

  Emulation type (default is vt320). This can be specified as the PARAM tag "emulation".
  See Also:
    term, Terminal, TerminalHost

modules

      protected Vector modules

  Dynamically loaded modules are stored here.

params

      public Hashtable params

  This Hashtable contains information retrievable by getParameter() in case the program is run as an application and the AppletStub is missing.

##

telnet

      public telnet()

##

getAppletInfo

      public String getAppletInfo()

  Retrieve the current version of the applet.
  Returns:
    String a string with the version information.
  Overrides:
    getAppletInfo in class Applet

getParameterInfo

      public String[][] getParameterInfo()

  Retrieve parameter tag information. This includes the tag information from terminal and loaded modules.
  Returns:
    String an array of array of string with tag information
  Overrides:
    getParameterInfo in class Applet
  See Also:
    getParameterInfo

getParameter

      public String getParameter(String name)

  We override the Applet method getParameter() to be able to handle parameters even as application.
  Parameters:
    name - The name of the queried parameter.
  Returns:
    the value of the parameter
  Overrides:
    getParameter in class Applet
  See Also:
    getParameter

main

      public static void main(String args[])

  The main function is called on startup of the application.

init

      public void init()

  Initialize applet. This method reads the PARAM tags "address", "port" and "emulation". The emulation class is loaded dynamically. It also loads modules given as parameter "module#".
  Overrides:
    init in class Applet

start

      public void start()

  Upon start of the applet try to create a new connection.
  Overrides:
    start in class Applet

stop

      public final void stop()

  Disconnect when the applet is stopped.
  Overrides:
    stop in class Applet

run

      public void run()

  Try to read data from the sockets and put it on the terminal. This is done until the thread dies or an error occurs.

connect

      public boolean connect()

  Connect to the specified host and port but don't break existing connections. Connects to the host and port specified in the tags.
  Returns:
    false if connection was unsuccessful

connect

      public boolean connect(String host)

  Connect to the specified host and port but don't break existing connections. Uses the port specified in the tags or 23.
  Parameters:
    host - destination host address

connect

      public boolean connect(String host,
                             int prt)

  Connect to the specified host and port but don't break existing connections.
  Parameters:
    host - destination host address
    prt - destination hosts port

disconnect

      public boolean disconnect()

  Disconnect from the remote host.
  Returns:
    false if there was a problem disconnecting.

send

      public boolean send(String str)

  Send a String to the remote host. Implements display.TerminalHost
  Parameters:
    s - String to be sent
  Returns:
    true if we are connected
  See Also:
    TerminalHost

notifyStatus

      public Object notifyStatus(Vector status)

  This method is called when telnet needs to be notified of status changes.
  Parameters:
    status - Vector of status information.
  Returns:
    an object of the information requested.
  See Also:
    StatusPeer