3.1 Calculator

The calcServer shell is a simple server shell containing a number of calculators. Each calculator is doing work for a single client. The example includes two different clients; an X based client, XcalcClient, using the Athena widget set, and a non X client, calcClient. To create the executables of the calculator example, copy the contents of the calculator directory to a directory of your own and compile:

beta calcClient calcServer XcalcClient.

Before running the calculator example, make sure that an ensembleDeamon is running on the host(s) involved (See section 5.1).

Now execute a calcServer on some network host, followed by the execution of a calcClient. The calcClient prompts for the name of the ensemble where it should lookup the calcServer. Answer with the name of the network host on which the calcServer is running.

If a calcServer is not started explicitly, as was the case above, or if the calcServer has terminated [4], the calcClient will fail to lookup a calcServer on the host whose name it was given. In this case the calcClient will try to start a new calcServer. For this to be possible, the following changes to the calcClient code could be made:

  1. Edit the defaultAppsDir virtual in calcClient.bet and XcalcClient.bet. If, for example, the source files were copied to the directory mydir, edit calcClient.bet as follows, or leave the default, which asks the user to enter the location:
    shellEnv
    (# defaultAppsDir:: 
         (# do 'mydir/$/' -> dir[] #);
       ...
    #)
  2. Recompile calcClient and XcalcClient
  3. Move the calcServer executable to the machine specific subdirectory of mydir, e.g. mydir/sun4s on a SPARC running Solaris 2.x.

With the above changes, the calcClient is able to create a new calcServer if one is not already running.


[4] The calcServer terminates itself when no new calculator has been created for 5 minutes


Distributed Objects in BETA - Reference Manual
© 1993-2004 Mjølner Informatics
[Modified: Monday October 23rd 2000 at 22:18]