-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer1.java
More file actions
30 lines (24 loc) · 931 Bytes
/
Server1.java
File metadata and controls
30 lines (24 loc) · 931 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
27
28
29
30
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class Server1 extends ImplExample {
public Server1(int server_no) {
super(server_no);
}
public static void main(String args[]) {
try {
ImplExample obj = new ImplExample(1);
ImplExample ob1 = new ImplExample(1);
Student stub = (Student) UnicastRemoteObject.exportObject(obj, 0);
Teacher stub1=(Teacher) UnicastRemoteObject.exportObject(ob1,1);
Registry registry = LocateRegistry.getRegistry();
registry.rebind("Server1S", stub);
registry.rebind("Server1T",stub1);
System.err.println("Server 1 ready");
} catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
}
}
}