DC - Exp 2
DC - Exp 2
1. Remote Procedure Call (RPC) - It is a protocol that allows a client to execute a procedure
(or function) on a remote server. The client sends a request to the server, which processes it and
returns a response. This "remote" interaction is abstracted so the client doesn't have to worry
about the details of communication over a network.
How it works:
● Client Side: The client calls a local proxy function that looks like the server-side function.
The proxy handles the network communication and sends the request to the remote server.
● Server Side: The server listens for requests, executes the requested procedure, and sends
back the result.
● Stubs and Skeletons: These are intermediary components that facilitate communication
between client and server:
○ Client Stub: It acts as a local proxy for the server function. When the client calls the
remote function, the stub handles marshalling (packing) the arguments, sending them
over the network, and returning the response.
○ Server Skeleton: It receives the call from the client, unpacks the arguments, calls the
actual server function, and sends the result back to the client.
● A client application might request data or processing from a remote server, like fetching
user details or performing a computation.
● Java RMI is an example of an RPC-based system.
● When working with heterogeneous systems or different programming languages (e.g.,
Python to Java communication).
● When you need simple procedure-based communication.
Code:
Client :
#client code
import xmlrpc.client
server = xmlrpc.client.ServerProxy('http://localhost:8001')
result = server.add(6, 5)
Server:
return x + y
server.register_function(add, 'add')
print("Server is running...")
server.serve_forever()
Output:
Conclusion: Therefore, we have learned and understood communication between client-
servers using RPC(Remote Procedure Call).
Abbreviation Meaning
CC coordinating conjunction
CD cardinal digit
DT determiner
EX existential there
FW foreign word
IN preposition/subordinating conjunction
LS list market