ActiveSocket

 Product Overview

 ActiveSocket Objects:
 
 How to use

 Online Samples

 Download (.exe)

 Brochure (.pdf)

 Manual (.htm)

 Release Notes


Support

 Knowledge Base

 Forum

 Contact Support


Purchase

 Licensing

 Pricing

 Order now


Related documents

 Tutorials

 Tools


  Download ActiveSocket Network Communications Toolkit 4.1  (5105 KB - .exe file)
  Download Manual  (505 KB - .htm file)

ActiveSocket - Rsh Object

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:
      » Icmp
      » Http
      » Ftp & FtpFile
      » DnsServer & DnsRecord
      » Ntp
      » Ssh
      » Rsh
      » SnmpManager
      » SnmpTrapManager
      » SnmpMibBrowser
      » Tcp
      » Udp
      » IPtoCountry
      » Wake-on-LAN


Rsh Sample code

     Visual Basic .NET sample: Execute a script on a remote LINUX machine using RSH
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  


     Visual C# .NET sample: Execute a script on a remote LINUX machine using RSH
   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




Copyright ©1999-2007 ActiveXperts Software. All rights reserved.