public class Rlogin extends Rexec implements java.io.Serializable
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
addBsdListener, clearProxySettings, disconnect, getBsdListeners, getCommand, getErrorStream, getInputStream, getOutputStream, getPassword, getPort, getRemoteHost, getTimeout, getUsername, hasErrorStream, removeBsdListener, setCommand, setPassword, setPort, setProxyAuthentication, setProxyHost, setProxyType, setRemoteHost, setTimeout, setUsername
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.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()
Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved