Package com.oroinc.net.telnet
Class TelnetClient
- java.lang.Object
-
- com.oroinc.net.SocketClient
-
- com.oroinc.net.telnet.TelnetClient
-
- Direct Known Subclasses:
FTP
public class TelnetClient extends SocketClient
The TelnetClient class implements the simple network virtual terminal (NVT) for the Telnet protocol according to RFC 854. It does not implement any of the extra Telnet options because it is meant to be used within a Java program providing automated access to Telnet accessible resources. A telnet client implementing extra options and meant for use with a terminal emulator can be found in NetComponents Pro TMThe class can be used by first connecting to a server using the SocketClient connect method. Then an InputStream and OutputStream for sending and receiving data over the Telnet connection can be obtained by using the getInputStream() and getOutputStream() methods. When you finish using the streams, you must call disconnect rather than simply closing the streams.
- Author:
- Daniel F. Savarese
-
-
Field Summary
-
Fields inherited from class com.oroinc.net.SocketClient
_defaultPort_, _input_, _isConnected_, _output_, _socket_, _socketFactory_, _timeout_, NETASCII_EOL
-
-
Constructor Summary
Constructors Constructor Description TelnetClient()Default TelnetClient constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_connectAction_()Handles special connection requirements.voiddisconnect()Disconnects the telnet session, closing the input and output streams as well as the socket.java.io.InputStreamgetInputStream()Returns the telnet connection input stream.java.io.OutputStreamgetOutputStream()Returns the telnet connection output stream.-
Methods inherited from class com.oroinc.net.SocketClient
connect, connect, connect, connect, connect, connect, getDefaultPort, getDefaultTimeout, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSoLinger, getSoTimeout, getTcpNoDelay, isConnected, setDefaultPort, setDefaultTimeout, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
-
-
-
-
Method Detail
-
_connectAction_
protected void _connectAction_() throws java.io.IOExceptionHandles special connection requirements.- Throws:
java.io.IOException- If an error occurs during connection setup.
-
disconnect
public void disconnect() throws java.io.IOExceptionDisconnects the telnet session, closing the input and output streams as well as the socket. If you have references to the input and output streams of the telnet connection, you should not close them yourself, but rather call disconnect to properly close the connection.- Overrides:
disconnectin classSocketClient- Throws:
java.io.IOException- If there is an error closing the socket.
-
getOutputStream
public java.io.OutputStream getOutputStream()
Returns the telnet connection output stream. You should not close the stream when you finish with it. Rather, you should call disconnect .- Returns:
- The telnet connection output stream.
-
getInputStream
public java.io.InputStream getInputStream()
Returns the telnet connection input stream. You should not close the stream when you finish with it. Rather, you should call disconnect .- Returns:
- The telnet connection input stream.
-
-