Quicklinks
RSh executes a command on a host. The remote hosts must run the RSh daemon. An RSh client utility is shipped with most operating systems these days. This RSh command line utility copies its standard input to the remote command, the standard output of the remote command to its standard output, and the standard error of the remote command to its standard error. Interrupt, quit and terminate signals are propagated to the remote command; rsh normally terminates when the remote command does.
The ActiveSocket RSh object has the same functionality as the RSh command-line utility, except that it has no user interface by itself: standard error and standard output are not copied to the console, but are copied to the corresponding object properties (StdErr and StdOut) instead.
The Rsh object is part of the ActiveSocket component. Overview of all ActiveSocket objects:
Imports ASOCKETLib
Module RShDemo
Sub Main()
Dim objRSh As RSh = New RSh
Dim objConstants As SocketConstants = New SocketConstants
objRSh.Clear()
objRSh.UserName = "root"
objRSh.Host = "192.168.1.10"
objRSh.Command = "/bin/ls"
objRSh.ScriptTimeOut = 5000
Console.WriteLine("Running command...")
objRSh.Run()
Console.WriteLine(" Result:" & objRSh.LastError.ToString())
If (objRSh.LastError = 0) Then
Console.WriteLine("StdErr:" & objRSh.StdErr)
Console.WriteLine("StdOut:" & objRSh.StdOut)
End If
Console.WriteLine("Ready.")
End Sub
End Module
using System;
using ASOCKETLib;
namespace RShDemo
{
class RShDemo
{
[STAThread]
static void Main(string[] args)
{
RSh objRSh = new RSh ();
objRSh.Clear();
objRSh.Host = "192.168.1.10";
objRSh.Command = "/bin/ls";
objRSh.ScriptTimeOut = 5000;
Console.WriteLine( "Running command..." );
objRSh.Run();
Console.WriteLine( "Result:"+objRSh.LastError.ToString());
if ( objRSh.LastError == 0 )
{
Console.WriteLine( "StdOut:" + objRSh.StdOut );
}
else
{
Console.WriteLine( "StdErr:" + objRSh.StdErr );
}
Console.WriteLine( "Ready." );
}
}
}
On ftp.activexperts-labs.com, you can find a lot of ActiveSocket samples. These samples are also part of the ActiveSocket installation.
» Visit ftp.activexperts-labs.com