RPC is the middle which allows client to call remote functions located on the server side. RPC is designed bearing in mind to combat the main disadvantage in inter-process communication (UDP and TCP) as it is hard in developing protocol. Moreover, we want to make distributed systems more transparent.
In order to call remote functions or methods, client depends on Stub function stimulating client as a real functions or methods locally.
RPC Process in 10 Steps
Client calls a local procedure, called a Client Stub
- It appears to the client that client stub is the actual server procedure that it wants to call
- The purpose of the stub is to package the arguments for the remote procedure into a standard format and then build one or more network messages. It is called marshalling.
These network messages are sent to the remote system by the client stub. This requires a system call to the local kernel
The network messages are transferring to the remote system
A Server Stub procedure is waiting on the remote system for the client’s request. It converts the received message from the standard format to the internal format to the remote system. This process is called Unmarshalling.
The server stub executes a local procedure call to invoke the actual server function.
When the server procedure is finished, it returns to server stub with return value.
The server stub converts the return values to the network standard format, puts them into one or more network messages, and call the kernel to send back to the client stub.
The messages are transferred back across the network to the client stub.
The client stub reads the network messages from the local kernel.
After converting the return value to its local format, the client stub finally returns to the client function.