home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / comm / tcp / amitcp-sdk / src / rpclib / getrpcport.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-29  |  894 b   |  39 lines

  1. /*
  2.  * $Id: getrpcport.c,v 4.2 1994/09/29 23:48:50 jraja Exp $
  3.  *
  4.  * Copyright © 1994 AmiTCP/IP Group,
  5.  *                  Network Solutions Development Inc.
  6.  *                  All rights reserved. 
  7.  */
  8.  
  9. /* @(#)getrpcport.c    2.1 88/07/29 4.0 RPCSRC */
  10. #if !defined(lint) && defined(SCCSIDS)
  11. static  char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI";
  12. #endif
  13.  
  14. /*
  15.  * Copyright (c) 1985 by Sun Microsystems, Inc.
  16.  */
  17.  
  18. #include <sys/param.h>
  19. #include <stdio.h>
  20. #include <rpc/rpc.h>
  21. #include <rpc/pmap_clnt.h>
  22. #include <netdb.h>
  23. #include <sys/socket.h>
  24.  
  25. int
  26. getrpcport(char *host, u_long prognum, u_long versnum, u_long proto)
  27. {
  28.     struct sockaddr_in addr;
  29.     struct hostent *hp;
  30.  
  31.     if ((hp = gethostbyname(host)) == NULL)
  32.         return (0);
  33.     bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
  34.     addr.sin_family = AF_INET;
  35.     addr.sin_port =  0;
  36.     return (pmap_getport(&addr, prognum, versnum, proto));
  37. }
  38.  
  39.