Portmapper version 2
Call the portmapper version 2. Note that version 2 is an older version (version 3 and 4 are called 'rpcbind'), but it is normally available.
The task of the portmapper is to map program numbers to port numbers. A RPC service that should be available in the whole network should:
set
procedure to establish a mapping of the
own program number to the port that has been allocated previouslyunset
procedure to remove the mapping
(this is NEVER done automatically!)To call an RPC service which is only known by its program number one should
contact the portmapper using getport
to find out the port where the
service is actually listening.
represents a client for the portmapper
Connects to the portmapper service listening on the given connector.
Connects to a portmapper listening on an Internet port. The argument is the hostname where the portmapper is running or its internet address. This function connects always to the port 111 on the given host; this is the standard for portmapper daemons.
Calls the 'NULL' procedure of the portmapper. This procedure has no effect. You can use 'null' to determine whether a procedure call is possible or not.
set pm_client program_nr version_nr protocol port_nr
:
Extends the mapping managed by the portmapper: The triple
(program_nr, version_nr, protocol)
is mapped to the given
port_nr
.
It is not allowed to overwrite an existing mapping.
The procedure returns true
if the mapping has been extended
and false
otherwise.
Note that it usually only possible to set
a mapping on the local
host.
unset pm_client program_nr version_nr protocol port_nr
:
removes the mapping.
The procedure returns true
if the mapping has been removed
and false
otherwise.
Note that it usually only possible to unset
a mapping on the local
host.
callit pm_client program_spec proc_name argument
:
This is an alternate way of calling a remote procedure. Instead
of directly invoking the procedure, the portmapper does it for you.
You must pass a program specification, the procedure name and the
argument to callit
. On return, you get the port of the service
and the result of the procedure invocation.
Note that there are several disadvantages:
callit
gets a timeout in this case.It is NOT recommended to use callit
for indirecting calls.
The callit
interface was designed for broadcasts and should only
be used for this purpose.
This implementation of a callit
client cannot be used for
broadcasts, however.
port_of_program program host protocol
:
queries the portmapper running on host
for the program
registered
for protocol
.
Returns the port number or fails if the number is not known.