EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.81k stars 415 forks source link

`connected` method not called on server but called on the client. #124

Open midn1 opened 7 years ago

midn1 commented 7 years ago

The client is ran on Android 5.1.1 and my server is on an Ubuntu 14.04.

Is this because my client calls Client.connect in a temporary thread?

sylvia43 commented 7 years ago

I was just having the same issue, but I figured it out. I was running client.addListener() after client.connect(...). The connect() event was fired before the listener is added. Maybe you might be having the same issue?

Running client.connect() on a temporary thread wouldn't be an issue, but if that runs before the listener is added, this could be the issue.

andrewse02 commented 3 years ago

This is what fixed my issue too! I was looking for like an hour or two trying to figure it out and I just found this! Thanks so much even over 3 years later this still fixed my simple mistake!

midn1 commented 3 years ago

Hell, I sometimes find solutions on mailing lists that are decades old :).