|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.net.SocketClient | +--org.apache.commons.net.bsd.RExecClient | +--org.apache.commons.net.bsd.RCommandClient | +--org.apache.commons.net.bsd.RLoginClient
RLoginClient is very similar to RCommandClient , from which it is derived, and uses the rcmd() facility implemented in RCommandClient to implement the functionality of the rlogin command that first appeared in 4.2BSD Unix. rlogin is a command used to login to a remote machine from a trusted host, sometimes without issuing a password. The trust relationship is the same as described in the documentation for RCommandClient .
As with virtually all of the client classes in org.apache.commons.net, this class derives from SocketClient. But it relies on the connection methods defined in RcommandClient which ensure that the local Socket will originate from an acceptable rshell port. The way to use RLoginClient is to first connect to the server, call the rlogin() method, and then fetch the connection's input and output streams. Interaction with the remote command is controlled entirely through the I/O streams. Once you have finished processing the streams, you should invoke disconnect() to clean up properly.
The standard output and standard error streams of the remote process are transmitted over the same connection, readable from the input stream returned by getInputStream() . Unlike RExecClient and RCommandClient, it is not possible to tell the rlogind daemon to return the standard error stream over a separate connection. getErrorStream() will always return null. The standard input of the remote process can be written to through the output stream returned by getOutputSream() .
SocketClient
,
RExecClient
,
RCommandClient
Field Summary | |
static int |
DEFAULT_PORT
The default rlogin port. |
Fields inherited from class org.apache.commons.net.bsd.RCommandClient |
MAX_CLIENT_PORT, MIN_CLIENT_PORT |
Fields inherited from class org.apache.commons.net.bsd.RExecClient |
_errorStream_ |
Fields inherited from class org.apache.commons.net.SocketClient |
_defaultPort_, _input_, _isConnected_, _output_, _socket_, _socketFactory_, _timeout_, NETASCII_EOL |
Constructor Summary | |
RLoginClient()
The default RLoginClient constructor. |
Method Summary | |
void |
rlogin(java.lang.String localUsername,
java.lang.String remoteUsername,
java.lang.String terminalType)
Same as the other rlogin method, but no terminal speed is defined. |
void |
rlogin(java.lang.String localUsername,
java.lang.String remoteUsername,
java.lang.String terminalType,
int terminalSpeed)
Logins into a remote machine through the rlogind daemon on the server to which the RLoginClient is connected. |
Methods inherited from class org.apache.commons.net.bsd.RCommandClient |
connect, connect, connect, connect, connect, connect, rcommand, rcommand |
Methods inherited from class org.apache.commons.net.bsd.RExecClient |
disconnect, getErrorStream, getInputStream, getOutputStream, isRemoteVerificationEnabled, rexec, rexec, setRemoteVerificationEnabled |
Methods inherited from class org.apache.commons.net.SocketClient |
_connectAction_, connect, connect, getDefaultPort, getDefaultTimeout, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSoLinger, getSoTimeout, getTcpNoDelay, isConnected, setDefaultPort, setDefaultTimeout, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_PORT
Constructor Detail |
public RLoginClient()
DEFAULT_PORT
.
Method Detail |
public void rlogin(java.lang.String localUsername, java.lang.String remoteUsername, java.lang.String terminalType, int terminalSpeed) throws java.io.IOException
If user authentication fails, the rlogind daemon will request that a password be entered interactively. You will be able to read the prompt from the output stream of the RLoginClient and write the password to the input stream of the RLoginClient.
localUsername
- The user account on the local machine that is
trying to login to the remote host.remoteUsername
- The account name on the server that is
being logged in to.terminalType
- The name of the user's terminal (e.g., "vt100",
"network", etc.)terminalSpeed
- The speed of the user's terminal, expressed
as a baud rate or bps (e.g., 9600 or 38400)
java.io.IOException
- If the rlogin() attempt fails. The exception
will contain a message indicating the nature of the failure.public void rlogin(java.lang.String localUsername, java.lang.String remoteUsername, java.lang.String terminalType) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |