Rmi Program For Displaying A Text
Rmi Program For Displaying A Text
Rmi Program For Displaying A Text
AIM
ALGORITHM
Step 1 : Create the interface in which declare the methods that is called by client.
Step 2 : Server
Implements the methods which is specified in interface
Register the remote object in which in RMI register in order to accessed by the
client
Step 3 : Client
Get the interface from RMI registry
Invoke the corresponding methods
Step 4 : Display the result.
PROGRAM
Interface
Import jave.rmi.*;
Import interface inter extends Remote
{
Public String show() throws RemoteException
}
Client Program
Import java.rmi.*;
Public class rmiclient
{
Public static void main(String args[]) throws Exception
{
Inter i=(inter) Naming.lookup(rmi://localhost:12345/hai”);
System.out.println(i.show()) ;
}
}
Server Program
Import java.rmi.*;
Import java.rmi.server.* ;
Import java.rmi.registry.* ;
Public class rmiserver 1 extends UnucastRemoteObject implements inter
{
Public rmiserver() throws RemoteException
{
Super();
}
Public String show() throws RemoteException
{
Return “hi”;
}
Public static void main(String args[]) throws Exception
{
Rmiserver s= new rmiserver();
LocateRegistry.createRegistry(12333);
Naming.bind(“rmi://localhost:12333/hai”,s);
System.out.println(“Server is Ready”) ;
}
}
OUTPUT
Command Prompt:
D:rmi>path=D:\bea\jdk1.4.0\bin
D:rmi>javac *.java
D:rmi>rmic rmiserver
D:rmi> java rmiserver
Server is Ready
D:rmi>path=D:\bea\jdk1.4.0\bin
D:rmi> java rmiclient
hi
RESULT
Thus the rmi program for displaying a text is created and executed successfully and the
output is verified.
EX.NO : RMI PROGRAM FOR ADDITION
DATE : OF ARRAY ELEMENTS
AIM
ALGORITHM
Step 1 : Create the interface in which declare the methods that is called by client.
Step 2 : Server
Implements the methods which is specified in interface
Register the remote object in which in RMI register in order to accessed by the
client
Step 3 : Client
Get the interface from RMI registry
Invoke the corresponding methods
Using the arguments the numbers are got.
Step 4 : Display the result.
PROGRAM
Interface
Client Program
Import java.rmi.*;
Public class rmiclient1
{
Public static void main(String args[]) throws Exception
{
Inter i=(inter) Naming.lookup(rmi://localhost:12345”);
Int a = Interger.parseInt(args[0);
Int b = Interger.parseInt(args[0);
System.out.println(i.add(a,b)) ;
}}
Server Program
Import java.rmi.*;
Import java.rmi.server.* ;
Import java.rmi.registry.* ;
Public class rmiserver 1 extends UnucastRemoteObject implements inter
{
Public rmiserver1() throws RemoteException
{
Super();
}
Public int add (int a, int b ) throws RemoteException
{
Return a+b;
}
Public static void main(String args[]) throws Exception
{
Rmiserver1 s= new rmiserver1();
LocateRegistry.createRegistry(12333);
Naming.bind(“rmi://localhost:12333”,s);
System.out.println(“Server is Ready”) ;
}}
OUTPUT
Command Prompt:
D:rmi>path=D:\bea\jdk1.4.0\bin
D:rmi>javac *.java
D:rmi>rmic rmiserver1
D:rmi> java rmiserver1
Server is Ready
D:rmi>path=D:\bea\jdk1.4.0\bin
D:rmi> java rmiclient1 22 14
36
RESULT
Thus the rmi program for adding the array elements is created and executed suceessfully
and the output is verified.
EX.NO: ACTIVEX DLL - TO REVERSE A STRING
DATE:
AIM
To write a program for ActiveX Dll that reverses a string.
ALGORITHM
DLL
VB
VB
Private sub Command1_click()
Dim s as class1
Set s=new class1
End sub
DLL
AIM
To write a program to create ActiveX DLL that finds maximum and minimum of 3
numbers.
ALGORITHM
ActiveX DLL
1.Goto start and select VB6.0 with ActiveX DLL.
2.Goto tools->Add procedure->give function name as max() and min() and edit coding.
3.Goto project menu->project1 properties and give project name and project description.
4.Save project.
5.Make project.dll through file menu.
VB
DLL
Public Function max(ByRef a As Integer, b As Integer, c As Integer)
If a > b Then
If a > c Then
MsgBox "maxval" & a
Else: MsgBox "maxval" & c
End If
If b > c Then
MsgBox "maxval" & b
Else
MsgBox "maxval" & c
End If
End If
End Function
VB