home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n001 / 2.ddi / EXAMPLES / UNION / CLIENT / CLIENT.C next >
Encoding:
C/C++ Source or Header  |  1989-12-11  |  2.5 KB  |  73 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: union\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 union example.  This program calls one
  24.  * remote procedure, opening and closing the connection for
  25.  * the call using the non-persistent style of process binding.
  26.  *
  27.  */ 
  28.  
  29. #include <stdio.h>
  30. #include "union.h"    /* client header file, created by RPC compiler */
  31.  
  32. extern int _rpcerr_;    /* Declare RPC error code */
  33.  
  34. /* Server_Name is used to set the process-binding variable.
  35.  * It must be defined as the name the server registers under.
  36.  */
  37. #define Server_Name "example"
  38.  
  39. /* declare variable of type server_name for process binding */
  40. server_name sname;
  41.  
  42. main()
  43. {
  44.     object nxt;
  45.  
  46.     sname = Server_Name;
  47.  
  48.     /* Example of call to remote procedure get_next() */
  49.     printf("CLIENT: call get_next()\n");
  50.     nxt = get_next();
  51.  
  52.     /* check RPC error code after remote call */
  53.     if (_rpcerr_) {
  54.         fprintf(stderr,"CLIENT: RPC error %d in get_next() call\n",
  55.                                      _rpcerr_);
  56.         exit(1);
  57.     }
  58.  
  59.     switch (nxt.class) {
  60.     case FLOAT:
  61.         printf("CLIENT: get_next() returned %e\n", nxt.inst.f);
  62.         break;
  63.     case LONG:
  64.         printf("CLIENT: get_next() returned '%ld'\n", nxt.inst.l);
  65.         break;
  66.     default: /* int */
  67.         printf("CLIENT: get_next() returned '%d'\n", nxt.inst.i);
  68.         break;
  69.     }
  70.  
  71.     exit(0);
  72. }
  73.