Changed port number and added standalone flag

- can use -standalone to just run the server
- Changed port number as to not conflict with some web servers
This commit is contained in:
Michael Rausch
2017-05-04 13:52:36 +12:00
parent a4cc5f222c
commit e77df0a5dd
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -39,12 +39,18 @@ public class App extends Application
e.printStackTrace(); e.printStackTrace();
} }
if (args.length == 1 && args[0].equals("-standalone")){
return;
}
if (args.length == 3 && args[0].equals("-server")){ if (args.length == 3 && args[0].equals("-server")){
sr = new StreamReceiver(args[1], Integer.valueOf(args[2]), "RaceStream"); sr = new StreamReceiver(args[1], Integer.valueOf(args[2]), "RaceStream");
} else if(args.length == 2 && args[0].equals("-server")){ } else if(args.length == 2 && args[0].equals("-server")){
switch (args[1]) { switch (args[1]) {
case "internal": case "internal":
sr = new StreamReceiver("localhost", 8085, "RaceStream"); sr = new StreamReceiver("localhost", 4949, "RaceStream");
break; break;
case "staffserver": case "staffserver":
sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941, "RaceStream"); sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941, "RaceStream");
@@ -56,7 +62,7 @@ public class App extends Application
} }
//Change the StreamReceiver in this else block to change the default data source. //Change the StreamReceiver in this else block to change the default data source.
else{ else{
sr = new StreamReceiver("localhost", 8085, "RaceStream"); sr = new StreamReceiver("localhost", 4949, "RaceStream");
} }
sr.start(); sr.start();
@@ -64,6 +70,9 @@ public class App extends Application
streamParser.start(); streamParser.start();
launch(args); launch(args);
} }
} }
@@ -21,7 +21,7 @@ public class ServerThread implements Runnable, Observer {
private final int RACE_STATUS_PERIOD = 1000/2; private final int RACE_STATUS_PERIOD = 1000/2;
private final int RACE_START_STATUS_PERIOD = 1000; private final int RACE_START_STATUS_PERIOD = 1000;
private final int BOAT_LOCATION_PERIOD = 1000/5; private final int BOAT_LOCATION_PERIOD = 1000/5;
private final int PORT_NUMBER = 8085; private final int PORT_NUMBER = 4949;
private final int TIME_TILL_RACE_START = 20*1000; private final int TIME_TILL_RACE_START = 20*1000;
private static final int LOG_LEVEL = 1; private static final int LOG_LEVEL = 1;