Remote Procedure Call or RPC


Remote procedure call (RPC) is an interprocess communication (IPC) mechanism that enables data exchange and invocation of functionality between different processes. These processes can be on the same computer or on local area network (LAN) or even across the internet. Microsoft has a service that runs for communicating between processes in the network which is called ms-rpc.

Remote Procedure Call

Remote Procedure Call

There basically are four components of RPC:
1. Caller: A program which calls a sub-routine
2. Callee: A sub-routine which calls is called by the caller.
3. Server: A program which accepts connections from a client and provides services to it.
4. Client: A program which requests connections and services from a server.

RPC Mechanism:
In order for an RPC to execute successfully, several steps must take place:

  1. The caller program cannot feed raw data to the remote procedure instead it must prepare input parameters to be passed to the RPC.  This is because the caller and the callee can reside in two different hardware so their certain data types may be different. To solve the problem of different data types (external data exchange) XDR or ASN.1 (Abstract Syntax Notation) is adopted as standard formats.
  2. In RPC call the calling program will have to pass the machine address of the target procedure plus the network address if it is being called from a network, else it only needs the machine address in the local processor.
  3. The RPC receives and operates on any input parameters and passes the result back to the caller.
  4. The calling program receives the RPC result and continues execution

To get a better look at Remote Procedure Call try the following examples on RPC:
1. rpcinfo -p localhost
2. cat /etc/rpc
3. rpcclient -c dir -i xxx.xxx.xxx.xxx -p xxxx
4. net rpc SHUTDOWN -C “Comment here” -f -I xxx.xxx.xxx.xxx -U username%password
5. rpcgen [infile]

References of  RPC:
1. http://www.opengroup.org/onlinepubs/9629399/chap2.htm
2. http://techchorus.net/xml-rpc-client-php-real-world-example-ping-technorati
3. http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec26.html
4. http://www.cs.rpi.edu/~hollingd/netprog/code/rpc/rfc1831.html
5. http://www.cs.rpi.edu/~hollingd/netprog/code/rpc/rfc1832.html
6.http://www.cs.cf.ac.uk/Dave/C/node33.html