20.2 RPC Test Program #2The RPC Test Program #2 is a simple client/server program that makes slightly more use of the DCE services than RPC Test Program #1. In this program, the server registers transport end points with the RPC daemon and exports binding information to the directory service. The client uses the auto-handle mechanism to import server binding information. To build this example program, enter the following commands:
After the build is complete, define the server executable file as a foreign command. Assign a symbol using the following command syntax:
For example, enter the following command:
Then start the server with the following command:
Once the server is running, you can run the client on the same host, or on any other host in the network that is configured to run in the same cell as the server host. Before running the client, you must define an environment variable (logical name) on the client system that can be used to locate the server binding information in the namespace during the auto-handle process:
After you define the environment variable, define the client executable file as a foreign command. Assign a symbol using the following command syntax:
For example, enter the following command:
Then run the client with the following command:
The client imports server binding information from the namespace. It makes a number of remote procedure calls, each of which results in a simple arithmetic function being executed. After making a sequence of calls, the client reports the average elapsed time for the calls to complete. By default, the client makes 10 passes with 100 calls per pass. You can specify the number of passes and the number of calls per pass by adding two arguments to the client startup command. For example, the following command instructs the client to make 5 passes, with 1000 calls per pass:
Because of the granularity of the clock on most systems, the average time per call will not be very accurate unless you set the number of calls per pass relatively high (at least 1000).
The client can be run as many times as desired, as long as the server
is still running.
This example implements a 2x2 matrix in a server application and allows the client application to manipulate the matrix with an IDL interface. The following features are listed:
20.3.1 How to Build Test Program #1 on OpenVMS SystemsCopy files from the DCE examples directory to your local directory.
To build the application, first define the symbol netaddr as the network address of the server. Then run the following command procedure:
If you have MMS on your system, you can use the included description file:
20.3.2 How to Run Test Program #1 on OpenVMS SystemsThe server advertises a named object with the DCE name service using the name defined by the IdentityMatrix literal defined in the globals.h header file. In order for the client to bind to this object using only the object's UUID, the RPC_DEFAULT_ENTRY environment variable must be set to this name. The server is run as follows:
You can also run the server using the MMS script as follows:
The advertised object is associated with a specific object UUID as noted by the IdentityMatrixId literal. In order to reuse the same object UUID consistently, an entry with the object UUID and interface UUID is explicitly exported to the name service. The following commands perform this task and are included in the command procedure:
Run the client as follows:
20.3.3 How to Build the Application Under POSIXCopy the files from the DCE examples directory to your POSIX accessible directory.
To build the application, run the following commands:
20.3.4 How to Run the Application Under POSIXThe server advertizes a named object with the DCE name service using the name defined by the IdentityMatrixId literal defined in the globals.h header file. In order for the client to bind to this object using only the object's UUID, the RPC_DEFAULT_ENTRY must be set to this name. The server is run as follows:
The advertized object is associated with a specific object UUID as noted by the IdentityMatrixId literal. In order to reuse the same object UUID consistently, an entry with the object UUID and interface UUID is explicitly exported to the name service. The following commands perform this task and are included in the make file:
Run the client as follows:
20.3.5 Application FilesTable 20-2 lists the application files.
20.4 Object-Oriented RPC Test Program #2This example implements a 2x2 matrix in a server application and allows the client application to manipulate the matrix with an IDL interface. The location transparency feature of IDL C++ support is emphasized in this example. The following features are illustrated:
20.4.1 How to Build the Application on OpenVMS SystemsCopy files from the DCE examples directory to your local directory.
To build the application, first define the netaddr as the network address of the server, then run the following command procedure:
If you have MMS, you can use the included description file as follows:
20.4.2 How to Run the Application on OpenVMSThis application makes use of the auto_handle feature of IDL. The server registers the binding handle under the name as specified by the environment variable EXAMPLE2_SERVER_ENTRY. The client must set the RPC_DEFAULT_ENTRY environment variable to this value before starting the process.
Run the client as follows:
To provide object location transparency, the client application must be
linked with the server stub and the server application must be linked
with the client stub. In order to avoid a name conflict with the static
member function createMatrix, the name is overridden in the
ACF with the name ClassFactory.
Copy the files from the DCE examples directory to your POSIX accessible directory.
To build the application, enter the following command:
20.4.4 How to Run the Application Under POSIXThis application makes use of the auto_handle feature of IDL. The server registers the binding handle under the name as specified by the environment variable EXAMPLE2_SERVER_ENTRY. The client must set the RPC_DEFAULT_ENTRY environment variable to this value before starting the process.
Run the client as follows:
20.4.5 Application FilesTable 20-3 lists the application files.
20.5 Book Distributed Calendar ProgramThe Book distributed calendar program (book) is a fairly sophisticated client/server application that makes use of a number of DCE services. The program registers transport end points with the RPC daemon, and it exports server binding information to the directory service. It also demonstrates some minimal use of mutex locks to protect resources on the server from access by multiple call threads. To build this example program, enter the following commands:
After the build is complete, define the server executable file as a foreign command. Assign a symbol using the following command syntax:
For example, enter the following command:
Then start the server with the following command:
The server takes two optional command arguments that affect the initialization sequence, as shown in Table 20-4.
The server calls a useful set of initialization routines from the DCE library (source code is also available for these in the modules rpcserver.c and rpcserver.h). The first call, to routine rpc_server_init(), starts a subprocess to run the server and initializes the RPC runtime with the appropriate parameters. The program does this before any other calls are made by the server to the RPC runtime and before any other threads calls are made (because thread context is not guaranteed to be preserved across a spawned or detached process). After performing other initialization functions (this program initializes a global mutex), the program makes a second call to rpc_server_detach(). This call releases the terminal associated with the parent process, after which the parent process is free to exit. The server then starts listening for client requests. Once the server is running, you can run the client on the same host, or on any other host in the network that is configured to run in the same cell as the server host. For example, enter the following command:
Then start the client with the following command:
The client imports server binding information from the directory service and causes the server to update the calendar file for the account in which the client is running. The client has a help facility that lists the commands that you can execute to modify the calendar database on the server. You can execute the client as many times as desired, as long as the server is still running. You can also run multiple clients with different names by passing different names as parameters to book. The following example runs one client program, for a user named David.
20.6 System Exerciser Example ProgramThe system exerciser example program exercises the basic DCE technologies: RPC, Security, CDS, DTS, and threads. The program is described in detail in the README file located in [SYSHLP.EXAMPLES.DCE.SX]. To build this example program, enter the following commands:
To run the program on OpenVMS systems, you must define a foreign command. To maintain consistent program names on DCE for OpenVMS systems, use the foreign command name shown in the following example. Assign a symbol using the following command syntax:
For example, enter the following command:
Then start the system exerciser with the following command.
The system exerciser command takes six optional command arguments, as shown in Table 20-5.
|
|