home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / tcpiptk / rpc / geneserv.c < prev    next >
Text File  |  1999-05-11  |  4KB  |  92 lines

  1. /********************************************************copyrite.xic********/
  2. /*                                                                          */
  3. /*   Licensed Materials - Property of IBM                                   */
  4. /*   IBM TCP/IP for OS/2                                                    */
  5. /*   (C) Copyright IBM Corporation. 1990,1996.                              */
  6. /*                                                                          */
  7. /*   All rights reserved.                                                   */
  8. /*                                                                          */
  9. /*   US Government Users Restricted Rights -                                */
  10. /*   Use, duplication or disclosure restricted by GSA ADP Schedule          */
  11. /*   Contract with IBM Corp.                                                */
  12. /*                                                                          */
  13. /*--------------------------------------------------------------------------*/
  14. /*                                                                          */
  15. /*  DISCLAIMER OF WARRANTIES.  The following [enclosed] code is             */
  16. /*  sample code created by IBM Corporation. This sample code is not         */
  17. /*  part of any standard or IBM product and is provided to you solely       */
  18. /*  for  the purpose of assisting you in the development of your            */
  19. /*  applications.  The code is provided "AS IS", without                    */
  20. /*  warranty of any kind.  IBM shall not be liable for any damages          */
  21. /*  arising out of your use of the sample code, even if they have been      */
  22. /*  advised of the possibility of such damages.                             */
  23. /*--------------------------------------------------------------------------*/
  24. /*                                                                          */
  25. /*   Modification History:                                                  */
  26. /*   Date:   By:   Tag:   Reason:                                           */
  27. /*   9.12.96 DRC   DRC01  Updated to include <stdlib.h>                     */
  28. /*                        the exclusion was generating a warning            */
  29. /*                        during compilation.                               */
  30. /*                                                                          */
  31. /*************************************************************copyrite.xic***/
  32.  
  33. /* GENERIC SERVER      */
  34. /* RECEIVE AN INTEGER OR FLOAT AND RETURN THEM RESPECTIVELY */
  35. /* PORTMAPPER MUST BE RUNNING */
  36.  
  37. #include <stdio.h>
  38. #include <stdlib.h>                         /* DRC01 - added include */
  39. #include <rpc/rpc.h>
  40.  
  41. #define intrcvprog ((u_long)150000)
  42. #define fltrcvprog ((u_long)150102)
  43. #define intvers    ((u_long)1)
  44. #define intrcvproc ((u_long)1)
  45. #define fltrcvproc ((u_long)1)
  46. #define fltvers    ((u_long)1)
  47.  
  48. main()
  49. {
  50.    char *intrcv();
  51.    char *floatrcv();
  52.  
  53.   /*REGISTER PROG, VERS AND PROC WITH THE PORTMAPPER*/
  54.       /*FIRST PROGRAM*/
  55.    registerrpc(intrcvprog,intvers,intrcvproc,intrcv,xdr_int,xdr_int);
  56.    printf("Intrcv Registration with Port Mapper completed\n");
  57.       /*OR MULTIPLE PROGRAMS*/
  58.    registerrpc(fltrcvprog,fltvers,fltrcvproc,floatrcv,xdr_float,xdr_float);
  59.    printf("Floatrcv Registration with Port Mapper completed\n");
  60.  
  61.    svc_run();
  62.    printf("Error:svc_run returned!\n");
  63.    exit(1);
  64. }
  65.  
  66. char *
  67. intrcv(in)
  68.    int *in;
  69. {
  70.    int *out;
  71.  
  72.    printf("integer received: %d\n",*in);
  73.    out = in;
  74.    printf("integer being returned: %d\n",*out);
  75.    return ((char *)out);
  76. }
  77.  
  78.  
  79. char *
  80. floatrcv(in)
  81.    int *in;
  82. {
  83.    int *out;
  84.  
  85.    printf("float received: %e\n",*in);
  86.    out=in;
  87.    printf("float being returned: %e\n",*out);   
  88.    return ((char *)out);
  89. }
  90.  
  91.  
  92.