Remote procedures in ONC RPC are identified by the 3-tuple: program number, version number, and procedure number.
It is usual to package several related procedures together into a single program. When changes are made to the procedures, a new version of the program is created, but the new version usually contains the same procedure numbers as the previous version.
Users define procedure numbers for each program, conventionally starting at 1 and proceeding in sequence. Procedure 0 is usually defined as a procedure with no parameters and no processing that returns an empty reply. This is useful for clients, who can call procedure 0 to see if a particular service exists and to test performance on a null call.
Servers on a host need to let clients know their logical addresses and which services they offer. In ONC RPC, servers generally do this by registering with a utility service called the Portmapper. This maintains a list of mappings from program/version numbers (also qualified by protocol used) to TCP/IP port numbers on a host.
The Portmapper itself can always be located by clients because it is always on well-known port 111 on a given host. If using low-level calls, the client first asks the Portmapper for the port number for the particular remote procedure, and then calls that port directly. The high-level call, callrpc, performs the same function transparently to the user.
Registration is done by CICS ONC RPC automatically, or under operator control.
Before calling a procedure, a client asks the Portmapper at the host for the port number of the program and version that the client wishes to call. (The protocol is determined when the connection between TCP/IP systems is set up.) In the remote procedure call, the client supplies only the IP address, port number, and procedure number. Figure 33 shows how the IP address, port number, and procedure number identify the server procedure.