How to change the host of the server?

Hello monkeys around! This question is more realted to @pspeed.

So, I always tested my server on the same computer. Now, I want to test it outside. I tried use hamachi and opening ports, but I can’t connect to my server. I noted that in the server, there is no host field to fill. Is that the problem or is another thing?

Server code:

private void initServer() throws IOException {
        server = Network.createServer("Cidade", 1, 6114, 6114);
        server.start();
        server.addMessageListener(this, JogadorEntrou.class, JogadorPos.class);
        server.addConnectionListener(this);
        System.out.println("Server on!");
    }

Client code (I used the Hamachi ip in this code to hide my public ip):

private void initClient() {
        try {
            client = Network.connectToServer("Cidade", 1, "25.150.242.43", 6114);
            client.start();
            client.addMessageListener(this, JogadorEntrou.class, JogadorSaiu.class, JogadorPos.class);
        } catch(ConnectException ce) {
            JOptionPane.showMessageDialog(null, "O servidor ainda não está ligado! Carrega em OK e abre outra vez o jogo!");
            ce.printStackTrace();
            System.exit(-1);
        } catch(IOException ioe) {
            JOptionPane.showMessageDialog(null, "Não foi possível entrar no servidor! Avisa o Ricardo!");
            ioe.printStackTrace();
            System.exit(-1);
        }
    }

Thanks,
Ev1lbl0w

I would have thought the server binds to the ip address of the host machine and all you would need to do is ensure you connect to the correct ip from the client.

client = Network.connectToServer("Cidade", 1, "25.150.242.43", 6114);

It’s hard to analyse network related issues like this but I suggest you set up a simple cloud based server somewhere without any firewall, install the server and then try to connect to it with your client on your machine, this should work assuming your client machine doesn’t block the request as well.

Adding in bridge interfaces such as Hamachi will most likely only introduce more complications, especially when trying to troubleshoot.

Another test would be to setup the server on another machine in your local network (if you have another machine) and try that first.

I also noticed there was a similar question at Client not seeing server. Windows Firewall Question

Not related to your real question but if you just want to simulate lag you can use clumsy, an utility for simulating broken network for Windows Vista / Windows 7 and above on windows. You will also have to test it on other machines but the results will be much more predictable.

What would you put in for the host that it doesn’t already know? It is the host.