-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConectServer.java
More file actions
71 lines (50 loc) · 1.89 KB
/
Copy pathConectServer.java
File metadata and controls
71 lines (50 loc) · 1.89 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
*
*
* @version 1.0 May 2018
* @author Amanda Camacho,
* Benjamin Amos <benjamin.oxi@gmail.com>
*/
public class ConectServer extends DuplicatesServers{
private int port;
private int clientPort=5600;
private InetAddress ipMulticas;
private String serverName;
public ConectServer(int controlPort , int servicePort, int replicationNumber,
Server2ServerOperations serverToServerOP,String multicasDirectt){
try {
this.port = servicePort;
ClientOperations newClientOperation =
new ClientImp(serverToServerOP);
Naming.rebind("rmi://localhost:"+servicePort+"/CalculatorService", newClientOperation);
} catch (Exception e) {
System.out.println("Trouble: " + e);
}
}
public static void main(String args[]) {
if (args.length <5) {
// Error
System.exit(1);
}else{
int controlPort= Integer.parseInt(args[0]);
int servicePort= Integer.parseInt(args[1]);
int replicationNumber= Integer.parseInt(args[2]);
try {
// Crea un Registry en el puerto especificado
LocateRegistry.createRegistry(servicePort);
}
catch (RemoteException re) {
System.out.println();
System.out.println("RemoteException");
System.out.println(re);
}
catch (Exception e) {
System.out.println();
System.out.println("java.lang.Exception");
System.out.println(e);
}
Server2ServerOperations serverToServerOperations=
new Server2ServerOperations(controlPort,"multicast",replicationNumber);
}
}
}