home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / tcpiptk / rpc / genesend.c next >
Text File  |  1999-05-11  |  4KB  |  71 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. /* GENESEND.C */
  33. /* Send an integer to the remote host and receive the integer back at the local host */
  34. /* PORTMAPPER AND REMOTE SERVER MUST BE RUNNING */
  35.  
  36. #include <stdio.h>
  37. #include <stdlib.h>                         /* DRC01 - added include */
  38. #include <rpc/rpc.h>
  39.  
  40. #define intrcvprog ((u_long)150000)
  41. #define version    ((u_long)1)
  42. #define intrcvproc ((u_long)1)
  43.  
  44. main(argc, argv)
  45.    int argc;
  46.    char *argv[];
  47. {
  48.    int innumber;
  49.    int outnumber;
  50.    int error;
  51.  
  52.    if (argc < 3) {
  53.       fprintf(stderr,"USAGE: genesend hostname integer\n");
  54.       exit (-1);
  55.    } /* endif */
  56.    svc_socks[1]=10;
  57.    innumber = atoi(argv[2]);
  58.    error = callrpc(argv[1],intrcvprog,version,intrcvproc,xdr_int,
  59.                    (char *)&innumber,xdr_int,(char *)&outnumber);
  60.    if (error != 0) {
  61.       fprintf(stderr,"error: CALLRPC failed: %d \n",error);
  62.       fprintf(stderr,"intrcprog: %d version: %d intrcvproc: %d",
  63.                       intrcvprog, version,intrcvproc);
  64.       exit(1);
  65.    } /* endif */
  66.  
  67.    printf("value sent was: %d   value received is: %d\n", innumber, outnumber);
  68.    exit(0);
  69. }
  70.  
  71.