When a program present in one computer wants to request something from another program which is running on another computer in a different network, then the protocol that the program may use is called Remote Procedure Call.
By using this protocol, the program doesn't have a need to know the network details.
Some of the applications of RPC are as follows −
Active Directory service in windows uses this protocol.
Most of the MMC terminals also use this protocol.
Many of the DCOM components are based on RPC.
Some utilities such as "Windows Computer Management", "registry editor", etc let us contact a remote system. These also use RPC protocol.
Let us consider the below diagram of RPC −
Step 1 − RPC consists of the client program called as stub procedure which is connected with its own address space. The parameters are passed in the usual way. The client does not find out or notice anything unusual about this call because it is a local call.
Step 2 − Now the client stub collects the parameters and packs them into a message. This operation is called parameter marshalling. After the message is constructed, it is given to the transport layer for transmission.
Step 3 − In a connectionless LAN system, the transport entity attaches a header to the message and sends it out on the network. In a WAN, the actual transmission is a little bit complicated.
Step 4 − When the message arrives at the server side, the transport entity will pass it to the server stub, and then it will unmarshall the parameters.
Step 5 − The server stub will then call the server procedure, passing the parameters in the standard way. The server procedure has no way of saying that it is being activated remotely because its immediate caller is a local procedure which obeys all the standard rules. Only the stubs know that something peculiar is going on.
Step 6 − After completion of its work, the server procedure returns the same way as any other procedure returns when it is finished. Then it returns a result to the caller.
Step 7 − The server stub which marshals the results into a message and hands it off at the transport interface, possibly by making a system call, as in step 2.
Step 8 − After that, the reply gets back to the client machine.
Step 9 − After replying it is handed to the client stub. Finally, the client stub returns to its caller, the client procedure.
Step 10 − Any value returned by the server is given to the client.