home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n001 / 2.ddi / EXAMPLES / ARRAY / 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: array\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 array example. This driver program calls two server 
  24.  * programs, opening and closing the connection for each call, i.e., a 
  25.  * non-persistent connection. 
  26.  */ 
  27.  
  28. #include <stdio.h>
  29. #include "array.h"    /* client header file, created by RPC compiler */
  30.  
  31. /* Server_Name is used to set the process-binding variable.
  32.  * It must be defined as the name the server registers under.
  33.  */
  34. #define Server_Name "example" 
  35.  
  36. extern int _rpcerr_;    /* declare RPC error code */
  37.  
  38. /* declare variable of type server_name for process binding */
  39. server_name sname;
  40.  
  41. int vec[] = {10, 20, 30, 40, 50, 60};
  42.  
  43. main()
  44. {
  45.     int size;
  46.     int result;
  47.  
  48.     sname = Server_Name;
  49.  
  50.     /* example of call to add_vec1 */
  51.  
  52.     size = sizeof(vec) / sizeof(int);
  53.     printf("CLIENT: calling add_vec1() with %d elements\n", size);
  54.     result = add_vec1(size, vec);
  55.  
  56.     if (_rpcerr_) {        /* check RPC return code */
  57.         printf("CLIENT: RPC error %d in add_vec1() call\n",
  58.             _rpcerr_);
  59.         exit(1);
  60.     }
  61.     printf("CLIENT: add_vec1() returned %d\n\n", result);
  62.  
  63.     /* example of call to add_vec2 */
  64.  
  65.     printf("CLIENT: calling add_vec2() with %d elements\n", size);
  66.     result = add_vec2(size, vec);
  67.  
  68.     if (_rpcerr_) {        /* check RPC return code */
  69.         printf("CLIENT: RPC error %d in add_vec2() call\n",
  70.             _rpcerr_);
  71.         exit(1);
  72.     }
  73.     printf("CLIENT: add_vec2() returned %d\n\n", result);
  74.  
  75.     exit(0);
  76. }
  77.