Remote procedure call
Remote procedure call definition
Remote procedure call (RCP) refers to a communication protocol that allows a computer program to execute a procedure (or a function) on a remote system or server. It enables programs running on different computers or operating systems to communicate and collaborate seamlessly.
How does remote procedure call work?
- Client request. The client program makes a request as if it was calling a local function. The client tells the remote computer the name of the specific task it wants to be done, and provides any information or instructions needed to complete the task.
- Client stub. The client-side RPC runtime library, known as a stub or client stub, intercepts the procedure call made by the client program. It packages the procedure name and arguments into a message or payload suitable for network transmission.
- Network communication. The client stub sends the RPC request message over the network to the server where the requested procedure resides. The message typically travels using a standard network protocol like TCP/IP.
- Server stub. On the server side, a server stub intercepts the incoming RPC request message, unpacks it, extracts the procedure name, and passes them to the actual server-side procedure.
- Procedure execution. The server-side procedure executes the requested functionality using the provided arguments.
- Return response. The server-side procedure returns the result to the server stub.
- Network communication. The server stub packages the response into an RPC message and sends it back to the client stub via the network.
- Client stub. The client stub receives the response from the server stub, unpacks it, and passes it back to the client program that initially made the RPC request.