com.sas.net.connect
Class SASTelnetClient

com.sas.net.connect.SASTelnetClient
All Implemented Interfaces:
TelnetClientInterface

public class SASTelnetClient
implements TelnetClientInterface

This class implements enough of the telnet protocol to bootstrap a Connect client.


Constructor Summary
SASTelnetClient()
          Construct a SASTelnetClient.
SASTelnetClient(java.util.Properties properties)
          Construct a SASTelnetClient with a list of properties.
 
Method Summary
 void connect(java.lang.String host)
          connect to the telnet daemon on the default port.
 void connect(java.lang.String host, int port)
          connect to the telnet daemon.
 void disconnect()
          disconnect from the telnet daemon.
 com.sas.net.crypto.CipherInterface getCipher()
          get the cipher object used by the telnet client.
 java.net.Socket getSocket()
          get the socket used by the telnet client.
 boolean isSocketInherited()
          true if the ConnectClient should inherit the socket used for the telnet connection.
 char receiveChar(int tioTimeout)
          receive data from the remote telnet session.
 void sendString(java.lang.String inString)
          send data to the remote telnet session.
 

Constructor Detail

SASTelnetClient

public SASTelnetClient(java.util.Properties properties)
Construct a SASTelnetClient with a list of properties. The following properties are recognized. None are required.

telnetTextFormat
the name of the character encoding used to encode text sent to and received from the telnet daemon. The default is ISO8859_1.
lineTerminator
a string to append to the end of every line sent to the telnet daemon. The default is \n. When connecting to a telnet daemon running on VMS, it is usually necessary to change this value to \r.
inputLineTerminator
a string that denotes the end of a line received from the telnet daemon. The default is \r\n.

Parameters:
properties - the list of properties

SASTelnetClient

public SASTelnetClient()
Construct a SASTelnetClient.

Method Detail

connect

public void connect(java.lang.String host,
                    int port)
             throws TelnetClientException
Description copied from interface: TelnetClientInterface
connect to the telnet daemon.

Specified by:
connect in interface TelnetClientInterface
Parameters:
host - host machine's IP name
port - TCP port number
Throws:
TelnetClientException - if there is an IO error

disconnect

public void disconnect()
                throws TelnetClientException
Description copied from interface: TelnetClientInterface
disconnect from the telnet daemon.

Specified by:
disconnect in interface TelnetClientInterface
Throws:
TelnetClientException - if there is an IO error

receiveChar

public char receiveChar(int tioTimeout)
                 throws TelnetClientException
Description copied from interface: TelnetClientInterface
receive data from the remote telnet session.

Specified by:
receiveChar in interface TelnetClientInterface
Parameters:
tioTimeout - number of milliseconds to wait for a character to arrive before throwing an exception. 0 means wait indefinitely.
Returns:
a character received from remote telnet session
Throws:
TelnetClientException - if there is an IO error or if a character does not arrive in the allowed time.

sendString

public void sendString(java.lang.String inString)
                throws TelnetClientException
Description copied from interface: TelnetClientInterface
send data to the remote telnet session.

Specified by:
sendString in interface TelnetClientInterface
Parameters:
inString - the string to send
Throws:
TelnetClientException - if there is an IO error

isSocketInherited

public boolean isSocketInherited()
Description copied from interface: TelnetClientInterface
true if the ConnectClient should inherit the socket used for the telnet connection. This method always returns false if called before connect or after disconnect.

Specified by:
isSocketInherited in interface TelnetClientInterface
Returns:
true if the ConnectClient should inherit the socket used for the telnet connection

getSocket

public java.net.Socket getSocket()
Description copied from interface: TelnetClientInterface
get the socket used by the telnet client. This method returns null if called before connect or after disconnect.

Specified by:
getSocket in interface TelnetClientInterface
Returns:
get the socket used by the telnet client

getCipher

public com.sas.net.crypto.CipherInterface getCipher()
Description copied from interface: TelnetClientInterface
get the cipher object used by the telnet client. This method returns null if called before connect or after disconnect.

Specified by:
getCipher in interface TelnetClientInterface
Returns:
get the cipher object used by the telnet client

connect

public void connect(java.lang.String host)
             throws TelnetClientException
connect to the telnet daemon on the default port.

Parameters:
host - host machine's IP name
Throws:
TelnetClientException - if there is an IO error



Copyright © 2009 SAS Institute Inc. All Rights Reserved.