EsotericSoftware / EsotericSoftware/kryonet

java.net.SocketTimeoutException: Connected, but timed out during TCP registration

Open
#132 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.9k
Forks
411
PR merge metrics
No merged PRs in 30d

Description

server runs fine. client cant connect.
it also says Note: Client#update must be called in a separate thread during connect.
But i got new thread for it ? sorry maybe im idiot :D
oh it crashes after client.connect(9999, ipAddress, tcpPort, 54777);
`public class ConnectClient {

private SomeRequest request;
private SomeResponse response;
private Client client;
public NetworkDATA network;
private String name;

private String ipAddress;
private int tcpPort, udpPort;

private MMORPG game;

public ConnectClient(MMORPG game){
this(NetworkDATA.SERVER_IP, NetworkDATA.SERVER_TCP_PORT, game);

}
public ConnectClient(String ipAddress, int tcpPort, MMORPG game) {

client = new Client();

this.ipAddress = ipAddress;
this.tcpPort = tcpPort;
//this.udpPort = udpPort;
this.game = game;

network.register(client);

}

public void runClient() {
Log.w("client started", "started");
// For consistency, the classes to be sent over the network are
// registered by the same method for both the client and server.
client.addListener(new Listener() {
public void connected(Connection connection) {
Log.w("connected", "connected");
NetworkDATA.RegisterName registerName = new NetworkDATA.RegisterName();
registerName.name = name;
client.sendTCP(registerName);
}
});
client.start();
new Thread("Connect") {
public void run() {
try {
Log.w("connecting", "zzz");
client.connect(9999, ipAddress, tcpPort, 54777); //CRASH HERE
// Server communication after connection can go here, or in Listener#connected().
} catch (IOException ex) {
ex.printStackTrace();
Log.w("CANT CONNECT", "ERROR");
System.exit(1);
}
}
}.start();
}
}`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.