Make your own free website on Tripod.com

socket
Class TelnetIO

java.lang.Object
  |
  +--socket.TelnetIO

public class TelnetIO
extends java.lang.Object
implements StatusPeer

Implements simple telnet io

Version:
$Id: TelnetIO.java,v 1.10 1998/02/09 10:22:18 leo Exp $
Author:
Matthias L. Jugel, Marcus Mei▀ner

Constructor Summary
TelnetIO()
           
 
Method Summary
 int available()
          Returns bytes available to be read.
 void connect(java.lang.String address)
          Connect to the remote host at the default telnet port (23).
 void connect(java.lang.String address, int port)
          Connect to the remote host at the specified port.
 void disconnect()
          Disconnect from remote host.
 java.lang.Object notifyStatus(java.util.Vector status)
          Notify about current telnet status.
 byte[] receive()
          Read data from the remote host.
 void send(byte b)
           
 void send(byte[] buf)
          Send data to the remote host.
 void setPeer(StatusPeer obj)
          Set the object to be notified about current status.
 java.lang.String toString()
          Return the version of TelnetIO.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TelnetIO

public TelnetIO()
Method Detail

toString

public java.lang.String toString()
Return the version of TelnetIO.
Overrides:
toString in class java.lang.Object

connect

public void connect(java.lang.String address,
                    int port)
             throws java.io.IOException
Connect to the remote host at the specified port.
Parameters:
address - the symbolic host address
port - the numeric port
See Also:
disconnect()

disconnect

public void disconnect()
                throws java.io.IOException
Disconnect from remote host.
See Also:
connect(java.lang.String, int)

connect

public void connect(java.lang.String address)
             throws java.io.IOException
Connect to the remote host at the default telnet port (23).
Parameters:
address - the symbolic host address

setPeer

public void setPeer(StatusPeer obj)
Set the object to be notified about current status.
Parameters:
obj - object to be notified.

available

public int available()
              throws java.io.IOException
Returns bytes available to be read. Since they haven't been negotiated over, this could be misleading. Most useful as a boolean value - "are any bytes available" - rather than as an exact count of "how many ara available."
Throws:
java.io.IOException - on problems with the socket connection

receive

public byte[] receive()
               throws java.io.IOException
Read data from the remote host. Blocks until data is available. Returns an array of bytes.
See Also:
send(byte[])

send

public void send(byte[] buf)
          throws java.io.IOException
Send data to the remote host.
Parameters:
buf - array of bytes to send
See Also:
receive()

send

public void send(byte b)
          throws java.io.IOException

notifyStatus

public java.lang.Object notifyStatus(java.util.Vector status)
Notify about current telnet status. This method is called top-down.
Specified by:
notifyStatus in interface StatusPeer
Parameters:
status - contains status information