tags:

views:

163

answers:

2

This is what I understand of it:

The .x file defines the interface and the parameters that are shared by the server and client. When you compile it with rpcgen, it generates the .h, _xdr.c, _clnt.c and _svc.c. The _clnt.c would be the stub and the _svc.c is the skelleton, right?

I understand that they intermediate the communication between the 2, but how so? Also, the example I've seen running had you specify the IP address of the machine to connect to (in the example it was using the same one, 127.0.0.1), but you don't specify the port. Does it have a reserved port?

+3  A: 

The procedure has two steps. There is a port mapper running on port 111 and a RPC service registers through and is discovered by this service but may itself run on an arbitrary port.

See RFC 1833 - Binding Protocols for ONC RPC Version 2 for details.

Daniel Brückner
A: 

On an RPC server machine, there is a process running called the endpoint mapper (this applies specifically to ONC RPC but other RPC mechanisms will be similar). This process runs on a known port.

A server will start up and register itself with the enpoint mapper, giving its code (e.g., MULT and port number) and the endpoint mapper will dutifully store that information.

When a client connects to the endpoint mapper using the IP address, it gives the desired code (MULT) and the endpoint mapper then provides the final destination - now the client knows the IP address and port for the MULT service.

At that point, the enpoint mapper can step out of the way and let the client open up a session directly with the MULT service.

paxdiablo

related questions