pmap_getport

Name

pmap_getport -- find the port number assigned to a service registered with a portmapper.

Synopsis

#include <rpc/pmap_clnt.h>

u_short * pmap_getport(struct sockaddr_in * address, const u_long program, const u_long * version, u_int protocol);

Description

The pmap_getport() function shall return the port number assigned to a service registered with a RPC Binding service running on a given target system, using the protocol described in RFC 1833: Binding Protocols for ONC RPC Version 2. The pmap_getport() function shall be called given the RPC program number program, the program version version, and transport protocol protocol. Conforming implementations shall support both IPPROTO_UDP and IPPROTO_TCP protocols. On entry, address shall specify the address of the system on which the portmapper to be contacted resides. The value of address->sin_port shall be ignored, and the standard value for the portmapper port shall always be used.

Note: Security and network restrictions may prevent a conforming application from contacting a remote RPC Binding Service.

Return Value

On success, the pmap_getport() function shall return the port number in host byte order of the RPC application registered with the remote portmapper. On failure, if either the program was not registered or the remote portmapper service could not be reached, the pmap_getport() function shall return 0. If the remote portmap service could not be reached, the status is left in the global variable rpc_createerr.