|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.bsd.Rexec
com.jscape.inet.bsd.Rlogin
public class Rlogin
Implements the functionality of a BSD rloginsh client.
Example Usage:
Rlogin rlogin = new Rlogin("remote.host.com", "johndoe", "johndoe", "vt100"); try { rlogin.connect(); rlogin.execute(); OutputReader reader = new OutputReader(rlogin.getInputStream(), System.out); InputWriter writer = new InputWriter(System.in, rlogin.getOutputStream()); reader.setPriority(Thread.currentThread().getPriority() + 1); reader.start(); writer.setDaemon(true); writer.start(); try { reader.join(); writer.interrupt(); } catch(InterruptedException e) { } ) catch(Exception e) { System.out.println(e); }
Constructor Summary | |
---|---|
Rlogin()
Initializes the Rlogin object with port set to 513. |
|
Rlogin(java.lang.String remoteHost,
java.lang.String username,
java.lang.String localUsername,
java.lang.String terminalType)
Initializes the Rlogin object with port set to 513 and all connection parameters. |
Method Summary | |
---|---|
void |
connect()
Initializes input and output streams to handle stdin and stdout of the remote host. |
void |
execute()
Executes rlogin negotiation with remote host. |
java.lang.String |
getLocalUsername()
Gets the local username to be sent to the remote host. |
int |
getTerminalSpeed()
Gets the speed of terminal emulation. |
java.lang.String |
getTerminalType()
Gets the terminal type to be used to distinguish between formating characters and normal text. |
void |
setLocalUsername(java.lang.String localUsername)
Sets the username of the user originating the connection. |
void |
setTerminalSpeed(int terminalSpeed)
Sets the speed of terminal emulation. |
void |
setTerminalType(java.lang.String terminalType)
Sets the terminal type to be used to distinguish between formating characters and normal text. |
Methods inherited from class com.jscape.inet.bsd.Rexec |
---|
addBsdListener, clearProxySettings, disconnect, getBsdListeners, getCommand, getErrorStream, getInputStream, getOutputStream, getPassword, getPort, getRemoteHost, getTimeout, getUsername, hasErrorStream, removeBsdListener, setCommand, setPassword, setPort, setProxyAuthentication, setProxyHost, setProxyType, setRemoteHost, setTimeout, setUsername |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Rlogin()
public Rlogin(java.lang.String remoteHost, java.lang.String username, java.lang.String localUsername, java.lang.String terminalType)
remoteHost
- the Internet name of the remote host.username
- the username of the user, whose credentials are to be
used to execute the command
.localUsername
- the username of the user who is initiating the
connection.terminalType
- the terminal type.Method Detail |
---|
public void connect() throws BsdException
connect
in class Rexec
BsdException
- if connection can not be established.public void execute() throws BsdException
InputStream
returned by getInputStream()
method. stdin can be accessed through an OutputStream
returned by getOutputStream()
. Further interaction with
rlogin service is exclusively done through these two streams.
To properly terminate connection, use disconnect()
method.
Beware that remote process will finish after EOF is sent to stdout, so
disconnecting too early will not terminate remote process.
execute
in class Rexec
BsdException
- if rsh negotiation fails.Rexec.getInputStream()
public void setLocalUsername(java.lang.String localUsername)
localUsername
- the local username to be sent to the remote host.public java.lang.String getLocalUsername()
public void setTerminalType(java.lang.String terminalType)
Unix restrictions apply - only 8 characters are allowed. Any excess is removed.
terminalType
- the terminal type to be sent to the remote host.public java.lang.String getTerminalType()
public void setTerminalSpeed(int terminalSpeed)
terminalSpeed
- the terminal speed to be used.public int getTerminalSpeed()
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |