programs quit when ports entered are wrong
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good
This commit is contained in:
parent
2cc2868450
commit
e4f637f317
@ -132,26 +132,13 @@ public class ClientP2P {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("using hostname : " + hostnameServer);
|
||||
if (serverPortRange.isPortInRange(portServer)){
|
||||
System.out.println("using port : " + portServer);
|
||||
}
|
||||
else {
|
||||
System.out.println("Port not in range. " + serverPortRange);
|
||||
portServer = serverPortRange.getDefaultPort();
|
||||
}
|
||||
System.out.println("tracker hostname : " + hostnameTracker);
|
||||
|
||||
if(trackerPortRange.isPortInRange(portTracker)){
|
||||
System.out.println("using port : " + portTracker);
|
||||
}
|
||||
else {
|
||||
System.out.println("Port not in range. " + trackerPortRange);
|
||||
portTracker = trackerPortRange.getDefaultPort();
|
||||
}
|
||||
|
||||
System.out.println("using hostname : " + hostnameServer);
|
||||
System.out.println("using port : " + portServer);
|
||||
System.out.println("tracker hostname : " + hostnameTracker);
|
||||
System.out.println("tracker port : " + portTracker);
|
||||
ClientP2P c = new ClientP2P(hostnameServer, portServer, hostnameTracker, portTracker);
|
||||
|
||||
ServerManagementUDP smudp = new ServerManagementUDP(c.directories.getDataHomeDirectory(), c.server, c.tracker, c.loggerServer);
|
||||
ServerManagementTCP smtcp = new ServerManagementTCP(c.directories.getDataHomeDirectory(), c.server, c.tracker, c.loggerServer);
|
||||
Thread tudp = new Thread(smudp);
|
||||
@ -196,4 +183,12 @@ public class ClientP2P {
|
||||
smudp.setStop();
|
||||
smtcp.setStop();
|
||||
}
|
||||
else{
|
||||
System.out.println("\n TRACKER: Port not in range. " + trackerPortRange);
|
||||
}
|
||||
}
|
||||
else{
|
||||
System.out.println("\n SERVER: Port not in range. " + serverPortRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,31 +90,19 @@ public class ServerP2P {
|
||||
System.out.println("enter tracker's port (default = " + trackerPortRange.getDefaultPort() + "): ");
|
||||
String portTrackerStr = scanner.nextLine();
|
||||
if(portTrackerStr.equals("")){
|
||||
portTracker = serverPortRange.getDefaultPort();
|
||||
portTracker = trackerPortRange.getDefaultPort();
|
||||
System.out.println("using default port : " + portTracker);
|
||||
} else {
|
||||
portTracker = Integer.valueOf(Integer.parseInt(portTrackerStr));
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("using hostname : " + hostnameServer);
|
||||
if (serverPortRange.isPortInRange(portServer)){
|
||||
System.out.println("using port : " + portServer);
|
||||
}
|
||||
else {
|
||||
System.out.println("Port not in range. " + serverPortRange);
|
||||
portServer = serverPortRange.getDefaultPort();
|
||||
}
|
||||
System.out.println("tracker hostname : " + hostnameTracker);
|
||||
|
||||
if(trackerPortRange.isPortInRange(portTracker)){
|
||||
System.out.println("using port : " + portTracker);
|
||||
}
|
||||
else {
|
||||
System.out.println("Port not in range. " + trackerPortRange);
|
||||
portTracker = trackerPortRange.getDefaultPort();
|
||||
}
|
||||
|
||||
System.out.println("using hostname : " + hostnameServer);
|
||||
System.out.println("using port : " + portServer);
|
||||
System.out.println("tracker hostname : " + hostnameTracker);
|
||||
System.out.println("tracker port : " + portTracker);
|
||||
ServerP2P s = new ServerP2P(hostnameServer, portServer, hostnameTracker, portTracker);
|
||||
ServerManagementUDP smudp = new ServerManagementUDP(s.directories.getDataHomeDirectory() + subdir, s.server, s.tracker, s.logger);
|
||||
ServerManagementTCP smtcp = new ServerManagementTCP(s.directories.getDataHomeDirectory() + subdir, s.server, s.tracker, s.logger);
|
||||
@ -125,4 +113,12 @@ public class ServerP2P {
|
||||
ttcp.setName("server TCP P2P-JAVA-PROJECT");
|
||||
ttcp.start();
|
||||
}
|
||||
else{
|
||||
System.out.println("\n TRACKER: Port not in range. " + trackerPortRange);
|
||||
}
|
||||
}
|
||||
else{
|
||||
System.out.println("\n SERVER: Port not in range. " + serverPortRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,12 +75,6 @@ public class Tracker {
|
||||
if(trackerPortRange.isPortInRange(port)) {
|
||||
System.out.println("using port : " + port);
|
||||
t = new Tracker(hostname, port);
|
||||
}
|
||||
else {
|
||||
System.out.println("Port not in range. " + trackerPortRange);
|
||||
t = new Tracker(hostname, trackerPortRange.getDefaultPort());
|
||||
}
|
||||
|
||||
TrackerManagementUDP tmudp = new TrackerManagementUDP(t.tracker, t.logger);
|
||||
TrackerManagementTCP tmtcp = new TrackerManagementTCP(t.tracker, t.logger);
|
||||
Thread tudp = new Thread(tmudp);
|
||||
@ -90,4 +84,8 @@ public class Tracker {
|
||||
ttcp.setName("Tracker TCP P2P-JAVA-PROJECT");
|
||||
ttcp.start();
|
||||
}
|
||||
else {
|
||||
System.out.println("Port not in range. " + trackerPortRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user