0% found this document useful (0 votes)
10 views3 pages

DC - Exp 2

The document outlines an experiment conducted by Taha Murade on implementing a client-server communication system using RPC (Remote Procedure Call) and RMI (Remote Method Invocation). It explains the theory behind RPC, including the roles of client stubs and server skeletons, and provides example code for both client and server implementations. The conclusion emphasizes the understanding gained regarding client-server communication through RPC.

Uploaded by

tahamurade01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

DC - Exp 2

The document outlines an experiment conducted by Taha Murade on implementing a client-server communication system using RPC (Remote Procedure Call) and RMI (Remote Method Invocation). It explains the theory behind RPC, including the roles of client stubs and server skeletons, and provides example code for both client and server implementations. The conclusion emphasizes the understanding gained regarding client-server communication through RPC.

Uploaded by

tahamurade01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment 2

Name of the Student: - Taha Murade


Roll No. : 74
Date of Practical Performed: - Staff Signature with Date & Marks

Aim: Write a program to perform Client server using RPC/RMI


Theory:
RPC (Remote Procedure Call) and RMI (Remote Method Invocation) are two popular
communication methods used in distributed systems, where a client can request services or
methods from a server as if they were local procedures or methods, even though they may be
running on different machines in the network.

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.

Example Use Case:

● 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

# Create a connection to the server

server = xmlrpc.client.ServerProxy('http://localhost:8001')

# Call the remote function to add two numbers

result = server.add(6, 5)

print(f"The result of adding two no's: {result}")

Server:

from xmlrpc.server import SimpleXMLRPCServer

# Function that the client will call remotely

def add(x, y):

return x + y

# Create an XML-RPC server

server = SimpleXMLRPCServer(('localhost', 8001))

# Register the function so the server can process it

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

JJ This NLTK POS Tag is an adjective (large)

JJR adjective, comparative (larger)

JJS adjective, superlative (largest)

LS list market

MD modal (could, will)

NN noun, singular (cat, tree)

You might also like