NonStop Software

Running the Stack Example

Previous Topic | Next Topic | Contents | Index
Administration Guide | Programmer's Guide | Reference Guide

Subtopics

The Stack Example Overview
Building the Stack Example
Running the Stack Example

Once you have installed NonStop DOM and have run through the Quick Configuration, you can test the operation of your NonStop DOM system by running a simple CORBA program.

The stack example works well to test your system–it is a simple but working CORBA program that has both a client and a server implemented in C++.

This topic guides you through the steps you need to follow to see the example run. For a detailed description on the workings of the program, see the ReadMe file in the example directory.

The Stack Example Overview

The Stack example can be found in the samples/stack subdirectory of your NonStop DOM installation. The README file in this directory describes how this program works, and the functions of the different files contained in the example.

Building the Stack Example

The stack example contains a file titled Makefile which lets you build the stack sample on NonStop DOM. The Makefile performs all of the required steps to construct the executable components. Macros that are used in the Makefile are defined in etc/macros.mk.

To build the sample:

  1. Make sure you are in the samples/stack directory of the NonStop DOM installation, or copy the files to a new directory
  2. Make sure you have sourced the env.sh script, which sets needed environment variables (see Quick Configure for details on customizing and sourcing this file).
  3. Execute the make script with the following command:
    make

The Makefile Script

When you execute the Makefile script, it does the following:

The NonStop DOM IDL compiler (NSDIDL), takes stack.idl file as input and produces the following four files:

You do not need to view or understand the contents of these files. Simply put, they contain the CORBA specified C++ language mapping translation of the interface definition. Client programs use the stack_client components to implement the client interface, and server programs use the stack_server components to implement the server interface.

Running the Stack Example

Before you can run the stack example, you must configure the stack server for your particular system. This is done by editing, then sourcing, the stack server configuration script config.src:

  1. Edit the config.src file, changing the <CHANGE_ME> value to a valid tcp host name or address.
  2. Use the Configuration Tool to source the stack server configuration script by issuing these commands at the OSS and Configuration Tool prompts:
    > cfgmgt
    > source config.src
    > exit
    
    These commands load the sample_stack@ORB entity.

You have now built and configured the stack example and are ready for the trial run. However, before you can run the stack example, you must start your NonStop DOM system as described in the topic Starting and Stopping NonStop DOM.

To run the stack example, open two OSS windows, one for the client portion of the program and one for the server portion. In each window, navigate to the directory where the stack sample was built, which is usually the samples/stack subdirectory of your NonStop DOM installation. Before running the program, make sure that each window has the correct NonStop DOM environment in place, which is obtained by sourcing the env.sh script, as described above.

Start the server program in one window with the following command:

server -ORBprofile sample_stack

In the other window, start the client program:

client

After starting the client program, you should see the following output in the client window:

Example 1. The Stack Example Output
   Top: 100
   Top: 200
   Top: 300
   Top: 400
   Top: 500
   Top: 600
   Top: 700
   Top: 800
   Top: 900
   Top: 1000
   Got STACK_OVERFLOW exception as expected.
   Pop: 1000
   Pop: 900
   Pop: 800
   Pop: 700
   Pop: 600
   Pop: 500
   Pop: 400
   Pop: 300
   Pop: 200
   Pop: 100
   Got STACK_UNDERFLOW exception as expected.

While the details of the program are beyond the scope of this topic, suffice to say that if you see the output as described above, you have successfully built and run the stack example on your NonStop DOM system.

Congratulations! You can now begin developing your own CORBA clients and servers on your NonStop DOM system.

If you do not obtain the output as described above, then something has gone wrong. Either you have not correctly installed and configured NonStop DOM, or you did not correctly build and run the example program. While it is difficult to predict the problem, you can start the debugging process by using PATHCOM to view the status of your NonStop DOM server pool processes.


Previous Topic | Next Topic | Contents | Top
Administration Guide | Programmer's Guide | Reference Guide
Bibliography | Glossary | Index
© Tandem, a division of Compaq. All rights reserved. Legal notices.