AREMOTE

The sample code for this TP provides the ability to control a text-mode program on a remote computer. AREMOTE is a Win32 console application that implements a client and a server. The AREMOTE server is invoked with the name of the text-mode program that the client wishes to control remotely. The AREMOTE client redirects stdin (keyboard input) from the client to the AREMOTE server. In turn, the AREMOTE server redirects stdin and stderr from the program being controlled back to the AREMOTE client.

Setup

    To set up AREMOTE
  1. Create an appropriate APPC LU-LU-mode triplet.
  2. Set up a CPI-C symbolic destination name that contains the configured remote LU and mode. (The TP name for AREMOTE is AREMOTE.)
  3. Assign the local APPC LU to the AREMOTE TP, either by using a registry entry of AREMOTE:REG_SZ:LocalLUAlias in the SnaBase\Parameters\Clients key, or by assigning the local LU as the default local APPC LU for the user who will run AREMOTE.

Input and Output

The syntax of the command line to start the client end of AREMOTE is as follows:

aremote /C ServerLU [/T TPName] [/P TPName] [/L LocalLU]
[/M Modename] [/N Lines] [/F Color] [/B Color]

where

/C
Specifies the client mode.
ServerLU
Specifies the SNA LU for connecting to the server.
/T TPName
Specifies the TP name that the server is using. The default is AREMOTE.
/P TPName
Specifies the TP name that the client is using. The default is AREMOTC.
/L LocalLU
Specifies the LU name for the local TP to use. The default is AREMOTE.
/M Modename
Specifies the mode name. The default is #INTER.
/N Lines
Specifies the number of lines to get.
/F Color
Specifies the foreground color. Color options are black, blue, green, cyan, red, purple, yellow, white, lblack, lblue, lgreen, lcyan, lred, lpurple, lyellow, and lwhite.
/B Color
Specifies the background color. Color options are black, blue, green, cyan, red, purple, yellow, white, lblack, lblue, lgreen, lcyan, lred, lpurple, lyellow, and lwhite.

The syntax of the command line to start the server end of AREMOTE is as follows:

aremote /S Cmd [/T TPName] [/M Modename] [/F Color] [/B Color]

where

/S
Specifies the server mode.
Cmd
Specifies a text-mode program that you want to control from another computer.
/T TPName
Specifies the TP name that the server is using. The default is AREMOTE.
/M Modename
Specifies the mode name. The default is #INTER.
/F Color
Specifies the foreground color. Color options are black, blue, green, cyan, red, purple, yellow, white, lblack, lblue, lgreen, lcyan, lred, lpurple, lyellow, and lwhite.
/B Color
Specifies the background color. Color options are black, blue, green, cyan, red, purple, yellow, white, lblack, lblue, lgreen, lcyan, lred, lpurple, lyellow, and lwhite.

The stdout and stderr from the command executed at the remote end is sent across the link and printed to stdout on the client. The stdin from the client is sent across the link and becomes the stdin for the command executed at the remote end.

The APPC remote installer (ARSETUP) included with this sample brings up a dialog box that prompts for TP configuration information. The information is then placed in the registry under Windows NT or in the WIN.INI file under Windows 3.x. The WIN32 compiler flag specifies that the Windows NT version of ARSETUP should be built, while the WINDOWS flag specifies the Windows 3.x version of ARSETUP.

Operation

The AREMOTE server can also be configured to run as a Windows NT service using the ARSETUP sample utility included in the same subdirectory on the CD-ROM.

The AREMOTE client can exit by inputting the following character sequences:

%cQ : Quit but leave the AREMOTE server running.

%cK : Exit and stop the AREMOTE server.

Other special client commands include the following:

%cM : Send a message to the AREMOTE server.

%cP : Show a popup on the AREMOTE server.

%cS : Report the status of the AREMOTE server.

%cH : Provide help describing these special client commands.