So I have made a Server with Kryonet. I also made a client. They connect fine over local host and all, but now that I have tried to move the server to my web server and run it from there it doesn’t seem to work. I changed localhost to the servers IP and I’m using the port 27960 for TCP and UDP.
Here is how I execute my jar on the server:
<?php
exec("java -jar /JARPATH/jar.jar", $output);
echo $output;
?/>
Warning I don’t have much knowledge of PHP.
And here is my Server code:
static Server server;
static int tcp = 27960, udp = 27960;
public static void main(String[] args) {
try {
server = new Server();
server.start();
server.bind(tcp, udp);
} catch (IOException e) {
e.printStackTrace();
}
server.addListener(new Listener() {
public void connected(Connection c) {
System.out.println("Succesful client connection");
}
public void received(Connection c, Object p) {
}
public void disconnected(Connection c) {
System.out.println("Succesful client disconnection");
}
});
}
And my client code:
public static Client client;
static String ip = "206.188.193.122";
static int tcp = 27960, udp = 27960;
public static void main(String[] args) {
try {
client = new Client();
client.start();
client.connect(5000, ip, tcp, udp);
} catch (IOException e1) {
e1.printStackTrace();
}
}
What could’ve went wrong here? I know the client connects. It’s got to be something with the IP and port I used. Though I don’t know any other ways I could go about doing this. Can you help?