home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n001 / 2.ddi / EXAMPLES / DEBUG / CLIENT / CLIENT.C next >
Encoding:
C/C++ Source or Header  |  1989-12-11  |  2.7 KB  |  77 lines

  1. /*                                                                            *
  2.  *                                                                            *
  3.  *                  Copyright 1987, 1988, 1989 Netwise, Inc.                  *
  4.  *                              All Rights Reserved                           *
  5.  *   This software contains information which is proprietary to and a trade   *
  6.  *   secret of Netwise, Inc. It is not to be used, reproduced, or disclosed   *
  7.  *   except as authorized in your license agreement.                          *
  8.  *                                                                            *
  9.  *                          Restricted Rights Legend                          *
  10.  *   Use, duplication,  or  disclosure  by the  Government  is  subject  to   *
  11.  *   restrictions as set forth in subparagraph (c)(1)(ii) of the Rights  in   *
  12.  *   Technical Data and  Computer Software clause  at 252.227-7013, or  the   *
  13.  *   equivalent Government clause for other agencies.                         *
  14.  *   Contractor: Netwise, Inc., Boulder, CO 80301 USA                         *
  15.  *                                                                            *
  16.  */ 
  17. /*
  18.  * File: debug\client\client.c
  19.  *
  20.  * This example works in the following environments:
  21.  *    NetWare RPC 1.0, NetWare 2.1 or higher, DOS 3.3
  22.  *
  23.  * This is the driver program for the debug example. The driver code
  24.  * calls the add and sub routines and reports the results. The code
  25.  * which is central to the example is the debug code in the RPC 
  26.  * specification file debug_i.rpc.
  27.  */
  28. #include <stdio.h>
  29. #include "debug.h"    /* client header file, created by the RPC compiler */
  30.  
  31. extern int _rpcerr_;    /* declare RPC error code */
  32.  
  33. /* Server_Name is used to set the process-binding variable.
  34.  * It must be defined as the name the server registers under.
  35.  */
  36. #define Server_Name  "example"
  37.  
  38. /* declare variable of type server_name for process binding */
  39. server_name sname;
  40.  
  41. main()
  42. {
  43.     int arg1, arg2;
  44.     int result;
  45.     int erc;
  46.  
  47.     sname = Server_Name;
  48.  
  49.     /* example of call to remote procedure add */
  50.     arg1=1234;
  51.     arg2=5678;
  52.     printf("CLIENT: calling add() with %d and %d\n", arg1, arg2);
  53.     result = add(arg1,arg2);
  54.  
  55.     if (_rpcerr_) {        /* check RPC return code */
  56.         printf("CLIENT: RPC error %d in add() call\n",
  57.             _rpcerr_);
  58.         exit(1);
  59.     }
  60.     printf("CLIENT: add() returned %d\n", result);
  61.  
  62.     /* example of call to remote procedure sub */
  63.     arg1=result;
  64.     arg2=5678;
  65.     printf("\nCLIENT: calling sub() with %d and %d\n", arg1, arg2);
  66.     result = sub(arg1,arg2);
  67.  
  68.     if (_rpcerr_) {        /* check RPC return code */
  69.         printf("CLIENT: RPC error %d in sub() call\n",
  70.             _rpcerr_);
  71.         exit(1);
  72.     }
  73.     printf("CLIENT: sub() returned %d\n", result);
  74.  
  75.     exit(0);
  76. }
  77.