|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package tracker;
|
|
|
|
|
|
|
|
|
|
import java.util.Scanner;
|
|
|
|
|
import javafx.util.Pair;
|
|
|
|
|
import tracker.TrackerManagementTCP;
|
|
|
|
|
import tracker.TrackerManagementUDP;
|
|
|
|
|
import tools.Directories;
|
|
|
|
@ -42,7 +43,7 @@ public class Tracker {
|
|
|
|
|
final String defaultPort = "6969";
|
|
|
|
|
final String defaultHostname = "localhost";
|
|
|
|
|
Scanner scanner = new Scanner(System.in);
|
|
|
|
|
TestPort testPortTracker = new TestPort();
|
|
|
|
|
TestPort testPort = new TestPort();
|
|
|
|
|
String hostname;
|
|
|
|
|
String port;
|
|
|
|
|
Tracker t;
|
|
|
|
@ -73,14 +74,15 @@ public class Tracker {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("using hostname : " + hostname);
|
|
|
|
|
if(testPortTracker.testPortTracker(Integer.parseInt(port))){
|
|
|
|
|
Pair<Integer, String> PtestPortTracker = testPort.testPortTracker(Integer.parseInt(port));
|
|
|
|
|
if(PtestPortTracker.getKey() == 0){
|
|
|
|
|
System.out.println("using port : " + port);
|
|
|
|
|
t = new Tracker(port);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
System.out.println("Wrong port (6000 -> 6999), using default port 6969");
|
|
|
|
|
System.out.println(PtestPortTracker.getValue());
|
|
|
|
|
t = new Tracker(defaultPort);
|
|
|
|
|
t.logger.write("Wrong port (6000 -> 6999), using default port 6969", LogLevel.Warning);
|
|
|
|
|
t.logger.write(PtestPortTracker.getValue(), LogLevel.Warning);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TrackerManagementUDP tmudp = new TrackerManagementUDP(hostname, t.port, t.logger);
|
|
|
|
|