Ex 8
Ex 8
EX.NO:8
DATE:
AIM:
To implement Remote Method Invocation with simple calculator application.
ALGORITHM:
1. Start.
2. Create a remote interface.
3. Provide the implementation of remote interface.
4. Compile the implementation class and create the stub and skeleton object using RMIC
tool.
5. Start the registry service by RMI registry tool.
6. Create and start remote application(server).
7. Create and start client application.
8. Stop.
SOURCE CODE:
calculator:
public interface calculator extends java.rmi.Remote
{
public long add(long a,long b) throws java.rmi.RemoteException ;
public long sub(long a,long b) throws java.rmi.RemoteException ;
public long mul(long a,long b) throws java.rmi.RemoteException ;
public long div(long a,long b) throws java.rmi.RemoteException ;
}
calc_impl :
public class calc_imp extends java.rmi.server.UnicastRemoteObject implements calculator
{
public calc_imp() throws java.rmi.RemoteException
{
super();
}
public long add(long a,long b) throws java.rmi.RemoteException
{
return a+b;
}
public long sub(long a,long b) throws java.rmi.RemoteException
OUTPUT: