-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.java
More file actions
26 lines (23 loc) · 744 Bytes
/
server.java
File metadata and controls
26 lines (23 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java .rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class server extends UnicastRemoteObject implements adder
{
public server() throws RemoteException{
}
@Override
public int add(int n1,int n2){
return n1+n2;
}
public static void main(String[] args) throws RemoteException{
try{
Registry reg=LocateRegistry.createRegistry(9999);
reg.rebind("hi server",new server());
System.out.println("Server is ready");
}
catch(RemoteException e){
System.out.println("exception"+e);
}
}
}