###############################################################################
#
# @(#)40        1.4  src/examples/demo/context_app/readme, examples.src, os2dce21.dss, 960602a.1  5/12/96  06:41:34
#
# COMPONENT_NAME:  examples.src
#
# FUNCTIONS: readme file for the context_app example
#
# ORIGINS: 72/27
#
# (C) COPYRIGHT International Business Machines Corp. 1995
#  All Rights Reserved
#  Licensed Materials - Property of IBM
#
#  US Government Users Restricted Rights - Use, duplication or
#  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# @OSF_COPYRIGHT@
# COPYRIGHT NOTICE
# Copyright (c) 1990, 1991, 1992, 1993, 1994 Open Software Foundation, Inc.
# ALL RIGHTS RESERVED (DCE).  See the file named COPYRIGHT.DCE in the
# src directory for the full copyright text.
#
###############################################################################
#
#
#
Directory:

   opt/dcelocal/examples/demo/context_app


This directory contains source files for the context handle example
application code described and discussed in the IBM DCE Application
Development Guide -- Introduction and Style Guide volume.

The following files contained in this directory are for use
in running the context_app:

    makefile.os2
    makefile.vc3
    makefile.bor
    makefile.wat
    readme
    context.acf
    context.idl
    context_client.c
    context_client.def
    context_manager.c
    context_server.c
    context_server.def


------------------------------------------------------------------------------

                 BUILDING THE CONTEXT APPLICATION

Refer to the main Examples Readme file in opt\dcelocal\examples
for information on how to build this example.

------------------------------------------------------------------------------

                  RUNNING THE CONTEXT APPLICATION

Very little is required in the way of preparation to run this applica-
tion:

    1. You must have a DCE cell up and running.

    2. You must create the following CDS directory:

           /.:/sample

    3. You must create the following namespace entry for the application
       server:

           /.:/sample/context_server_entry

    4. On the client machine (or window, if you're running the application
       on a single machine), you must set the value of the environment
       variable RPC_DEFAULT_ENTRY to the pathname of the server's name-
       space entry.


Note that the server entry pathname is determined by the value of the
EXPORT_ENTRY string constant defined at the top of the context_server.c
file; you can change the value of the latter, in which case you must make
the corresponding change in the pathname given in steps 2 and 3 above.

Steps 2 and 3 can be accomplished as follows:


    1. Login as the cell administrator:

           $ dcelogin cell_admin -dce-

       Note that the password at your site will probably be different from
       that given above (as the last parameter). For further information
       about the use of dcelogin, see the IBM DCE Administration Guide.

    2. Create the CDS entry that will be used to hold the server's binding
       information. For example (using the names given above):

           $ cdscp create directory /.:/sample
           $ rpccp add entry /.:/sample/context_server_entry

       For further information about cdscp and rpccp, see the IBM DCE Admini-
       stration Guide -- Core Components, and the IBM DCE Administration Ref-
       erence.


That's all there is to it. In order to keep things simple, the application
makes no use at all of DCE Security; hence there is no need to set up the
ACL on the server entry, or to create a keytab file, and so on.

Once the above steps have been completed, the server can be invoked as
follows:

        # context_server

Wait for the server's "Listening for calls" message before starting the client.
The client can be invoked (either from another machine in the cell, or from
another window if on the same machine) as follows:

        # set RPC_DEFAULT_ENTRY=/.:/sample/context_server_entry
        # context_client <message>

where <message> is a string that the client will write to and read from
a storage area opened and maintained by the server; the client accesses
this storage area by a context handle returned to it by the server.

                           RESULTS

The context_client program writes <message> to the context buffer two times.
It then reads and displays the two messages that are in the context buffer
two times.  The first time the program reads the context buffer, the program
starts at character 2.  The second time the program reads the context buffer,
the program starts at character 0.

For examples, assume you start the the context_client program as follows:

       context_client 1234

The context_client program displays the following:

       341234
       12341234

------------------------------------------------------------------------------
                          SERVER OUTPUT

context_server: Starting up . . .
context_server: Calling rpc_server_register_if(). . .
context_server: Calling rpc_server_use_all_protseqs(). . .
context_server: Calling rpc_server_inq_bindings(). . .
context_server: Calling rpc_ep_register(). . .
context_server: Calling rpc_ns_binding_export(). . .
context_server: Listening for calls(). . .

StoreManager: Initializing Store
StoreManager: Closing Store


------------------------------------------------------------------------------
                          CLIENT OUTPUT

context_client: Calling rpc_ns_binding_import_begin()...
context_client: Calling rpc_ns_binding_import_next()...
context_client: Calling rpc_ns_binding_import_done()...
context_client: Calling rpc_binding_to_string_binding()...
context_client: Imported resolved binding == ncacn_ip_tcp:9.3.45.83[]
context_client: Calling rpc_string_free()...
Simple Context Client: Read: 341234
Simple Context Client: Read: 12341234

------------------------------------------------------------------------------
