Preparing code to retrieve the server port over SSDP instead of using a defult port number.

This commit is contained in:
dcollin 2015-11-05 13:58:45 +01:00
parent 2b86fb4ce6
commit d5b40053fb
4 changed files with 16 additions and 12 deletions

View file

@ -18,7 +18,6 @@ import com.coder.client.gui.selectProject.SelectProjectDialog;
import com.coder.client.gui.selectProject.SelectProjectDialogListener;
import com.coder.client.gui.selectServer.SelectServerDialog;
import com.coder.client.gui.selectServer.SelectServerDialogListener;
import com.coder.server.CoderServer;
import com.coder.server.message.*;
import zutil.log.CompactLogFormatter;
@ -92,8 +91,8 @@ public class CoderClient extends Application{
try{
selectServerDialog.setServerPort(Integer.parseInt(value));
}catch(NumberFormatException e){
logger.warning("port argument to program is not of a integer type. using default port.");
selectServerDialog.setServerPort(CoderServer.SERVER_PORT);
logger.warning("port argument to program is not of a integer type");
selectServerDialog.setServerPort(-1);
}
}else if(key.equals("project")){
selectProjectDialog.setProject(value);
@ -109,7 +108,7 @@ public class CoderClient extends Application{
}
//start program logic
selectServerDialog.setServerPort(CoderServer.SERVER_PORT);
selectServerDialog.setServerPort(-1);
selectServerDialog.showOnStage(mainStage);
}
@ -125,7 +124,7 @@ public class CoderClient extends Application{
if(ssdpClient != null){
ssdpClient.requestService("coder:discover");
for(StandardSSDPInfo server : ssdpClient.getServices("coder:discover"))
selectServerDialog.addServerToList(server.getInetAddress().getHostAddress());
selectServerDialog.addServerToList(server.getInetAddress().getHostAddress(), 1337);
}else{
logger.severe("could not send a SSDP request since the client is not setup");
}
@ -424,7 +423,7 @@ public class CoderClient extends Application{
@Override
public void run() {
String ip = service.getInetAddress().getHostAddress();
selectServerDialog.addServerToList(ip);
selectServerDialog.addServerToList(ip, 1337);
}
});
} else {