RExecClient implements the rexec() facility that first appeared in 4.2BSD Unix. This class will probably only be of use for connecting to Unix systems and only when the rexecd daemon is configured to run, which is a rarity these days because of the security risks involved. However, rexec() can be very useful for performing administrative tasks on a network behind a firewall.
As with virtually all of the client classes in org.apache.commons.net, this class derives from SocketClient, inheriting its connection methods. The way to use RExecClient is to first connect to the server, call the {@link #rexec rexec() } method, and thenfetch the connection's input, output, and optionally error streams. Interaction with the remote command is controlled entirely through the I/O streams. Once you have finished processing the streams, you should invoke {@link #disconnect disconnect() } to clean up properly.
By default the standard output and standard error streams of the remote process are transmitted over the same connection, readable from the input stream returned by {@link #getInputStream getInputStream() }. However, it is possible to tell the rexecd daemon to return the standard error stream over a separate connection, readable from the input stream returned by {@link #getErrorStream getErrorStream() }. You can specify that a separate connection should be created for standard error by setting the boolean separateErrorStream
parameter of {@link #rexec rexec() } to true
.The standard input of the remote process can be written to through the output stream returned by {@link #getOutputStream getOutputSream() }.
@author Daniel F. Savarese
@see SocketClient
@see RCommandClient
@see RLoginClient