home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n001 / 2.ddi / EXAMPLES / NONPER / CLIENT / CLIENT.C next >
Encoding:
C/C++ Source or Header  |  1989-12-11  |  2.8 KB  |  79 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: nonper\client\client.c
  19.  *
  20.  * This example runs in the following environments:
  21.  *    NetWare RPC 1.0, NetWare 2.1 or higher, DOS 3.3
  22.  *
  23.  * Client code for the nonper example.  Connection establishment is done
  24.  * for each remote procedure call.  This connection is closed at the 
  25.  * completion of each RPC.
  26.  */ 
  27.  
  28. #include <stdio.h>
  29. #include "nonper.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.  
  46.     sname = Server_Name;
  47.  
  48.     /* example of call to remote procedure add() */
  49.  
  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\n", result);
  61.  
  62.     /* example of call to remote procedure sub() */
  63.  
  64.     arg1=result;
  65.     arg2=5678;
  66.     printf("CLIENT: calling sub() with %d and %d\n", arg1, arg2);
  67.     result = sub(arg1,arg2);
  68.  
  69.     if (_rpcerr_) {        /* check RPC return code */
  70.         printf("CLIENT: RPC error %d in sub() call\n",
  71.             _rpcerr_);
  72.         exit(1);
  73.     }
  74.     printf("CLIENT: sub() returned %d\n", result);
  75.     printf("CLIENT: server should shut down automatically\n");
  76.  
  77.     exit(0);
  78. }
  79.