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

@ -79,6 +79,7 @@ public class SelectServerDialog extends GuiWindow {
if(observable.getValue() != null){
logger.fine("ServerListItem [" + observable.getValue() + "] selected in the server list");
address = observable.getValue().getIP();
port = observable.getValue().getPort();
connectButton.setDisable(false);
}else{
connectButton.setDisable(true);
@ -138,9 +139,9 @@ public class SelectServerDialog extends GuiWindow {
return "Select Server";
}
public void addServerToList(String ip) {
public void addServerToList(String ip, int port) {
logger.fine("Adding server \"" + ip + "\" to server list");
ServerListItem item = new ServerListItem(ip);
ServerListItem item = new ServerListItem(ip, port);
this.serverList.add(item);
}

View file

@ -3,17 +3,23 @@ package com.coder.client.gui.selectServer;
class ServerListItem {
private String ip = null;
private int port = -1;
public ServerListItem(String ip){
public ServerListItem(String ip, int port){
this.ip = ip;
this.port = port;
}
public String getIP(){
return this.ip;
}
public int getPort(){
return port;
}
public String toString(){
return "SERVER: ip="+ip;
return "SERVER: ip="+ip+":"+port;
}
}