DCL - Experiment 3 1
DCL - Experiment 3 1
Experiment No. 3
PART B
(PART B: TO BE COMPLETED BY STUDENTS)
Class: Batch:
Grade:
B.1 Software Code written by student:
● Server.py
now=datetime.datetime.now()
print('date: '+now.strftime('%d-%m-%y')+' Time:'+now.strftime('%H:%M:%S'))
@Pyro4.expose
class Server(object):
def get_usid(self, name): return "Hello,
{0}.\n" \
"Your Current User Session is {1}:".format(name, random.randint(0,1000))
1
def add(self, a, b): return "{0} + {1} =
{2}".format(a, b, a+b)
def subtract(self, a, b): return "{0} - {1} = {2}".format(a,
b, a-b)
daemon.requestLoop()
● Client.py
import Pyro4
import os import
datetime Client =
Pyro4.Proxy("PYR
ONAME:RMI.calc
ulator") name
=input("What is your
name? ").strip()
2
now=datetime.da
tetime.now()
3
1. ADDITION
4
5
3. MULTIPLICATION
5. SQUARE
6
7. MOD
7
9. EXPONENTIATION
8
B.3 Observations and learning:
In a distributed computing environment, remote method invocation (RMI) refers to calling a
method on a remote object. It is analogous to a remote procedure call.
B.4 Conclusion:
Successfully implemented a calculator application using RMI.
9
- Unmarshalling is the process in which an object or data structure is deserialized.
10
Q3: How is the stub generated?
ANS:
- Stubs are generated either manually or automatically. In a manual generation, a remote
procedure call implementer provides translation functions, from which a user
constructs stubs. They handle complex parameter types. Automatic stub generation is
commonly used to generate stubs. They use integration description language to define
client and server interfaces.
11