trying to fix server ip to use outward ip
This commit is contained in:
@@ -130,9 +130,7 @@ public void setJoin(String ip, int port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void leave() {
|
public void leave() {
|
||||||
LOGGER.log(Level.INFO, "leave");
|
app.getGameLogic().selectLeave();
|
||||||
app.getAcousticHandler().playSound(MdgaSound.LEAVE);
|
|
||||||
enter(MdgaState.MAIN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enter(MdgaState state) {
|
public void enter(MdgaState state) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.System.Logger;
|
import java.lang.System.Logger;
|
||||||
import java.lang.System.Logger.Level;
|
import java.lang.System.Logger.Level;
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
@@ -67,6 +68,9 @@ public void run() {
|
|||||||
private void startServer() {
|
private void startServer() {
|
||||||
try {
|
try {
|
||||||
LOGGER.log(Level.INFO, "Starting server..."); //NON-NLS
|
LOGGER.log(Level.INFO, "Starting server..."); //NON-NLS
|
||||||
|
InetAddress localhost;
|
||||||
|
localhost = InetAddress.getLocalHost();
|
||||||
|
String ip = localhost.getHostAddress();
|
||||||
myServer = Network.createServer(port);
|
myServer = Network.createServer(port);
|
||||||
initializeSerializables();
|
initializeSerializables();
|
||||||
myServer.start();
|
myServer.start();
|
||||||
@@ -190,6 +194,7 @@ private void messageReceived(HostedConnection source, ClientMessage message) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionAdded(Server server, HostedConnection hostedConnection) {
|
public void connectionAdded(Server server, HostedConnection hostedConnection) {
|
||||||
|
System.out.println("new connection " + hostedConnection); //NON-NLS
|
||||||
LOGGER.log(Level.DEBUG, "new connection {0}", hostedConnection); //NON-NLS
|
LOGGER.log(Level.DEBUG, "new connection {0}", hostedConnection); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ private void tryHost() {
|
|||||||
|
|
||||||
if(port >= 1 && port <= 65535) {
|
if(port >= 1 && port <= 65535) {
|
||||||
app.getModelSynchronize().setName(startDialog.getName());
|
app.getModelSynchronize().setName(startDialog.getName());
|
||||||
hostDialog.setHostname(Inet4Address.getLocalHost().getHostAddress());
|
|
||||||
hostDialog.hostServer();
|
hostDialog.hostServer();
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
@@ -117,10 +116,7 @@ private void tryHost() {
|
|||||||
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException ignored) {
|
||||||
//nothing
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hostDialog.resetPort();
|
hostDialog.resetPort();
|
||||||
|
|||||||
Reference in New Issue
Block a user