Open ghost opened 10 years ago
From twazerty on September 09, 2013 12:36:43
I have the same problem when I only connect via TCP (Server listens on TCP and UDP). When I connect with TCP and UDP in de client everything works ok.
From renne...@gmail.com on November 06, 2013 01:46:15
I also had this problem.
I got the same problem. Is there a solution for this problem?
I am also having this problem, any solution found? @Kronos87
See discussion here: https://code.google.com/p/kryonet/issues/detail?id=34 Please continue any further discussion in this thread though.
Hey guys, just wanted to add that we're seeing this behavior in the development of an Android app that utilizes Kryonet - when connecting the client only via TCP, it establishes a connection, but any sendTCP calls don't result in the server receiving any data. The server's connected() is not invoked, and the client shortly disconnects after not receiving any response from the server. We are using discoverHost as the basis for the host address the client uses.
If we update the client connect() call to include the UDP port, everything works as expected. The workaround seems to be having the client specify both TCP and UDP ports in connect(), though I do not know the specifics as to what is causing this internally within the Kryonet source (we're using the latest 2.21-all jar in our project).
Just wanted to add our experience, and that the above workaround appears to be working in our case - I hope this helps.
I experience the same problem and the same solution. You have to specify the UDP and TCP port. Please fix that problem!
No one shows an executable example and all the KryoNet tests pass, so I assume your code is wrong. Guessing at your problem is usually a waste of time, but probably you start a server that expects both a TCP and UDP connection from a client.
I'll prepare an example next week.
If your server has a TCP and UDP port, your clients must also. You can run a separate server for UDP discovery.
Also,when having both ports fail, all of your classes that you register with Kryo, should have an empty constructor inside them, fixed the problem for me. Might be worth putting this into the readme, aswell :) , otherwize this thing is :+1:
I'm sorry I forget this issue here.
@NathanSweet Yes, that was the solution! I needed to specify both ports for the clients, too! Thanks :)
hit the same issue. my problem was that I registered the UUID class which doesn't provide a public default constructor. replacing it solved the problem for me
@breskeby Exact same problem here. I'd thought I'd added default constructors to all registered classes, but there was one without. Adding a default constructor fixed it immediately.
I agree with @MarkSill, I faced the same problem yesterday and adding ALL default constructors fixed everything! Someone should spread this around.
@Isfirs Same issue, same solution. Public default constructors need to be added to every single one.
Sounds like two separate problems:
What error does 2 provide? It should be explicit that a zero arg constructor is needed. Does it fail silently instead? If so, are you using StdInstantiatorStrategy? Using that is not recommended (it creates objects without calling any constructor).
KryoNet is due for an update to the latest Kryo, that may help.
My problem was multi-fold...
1.) initially I was using Kotlin data class, which doesn't create empty constructor out of the box
2.) Kotlin also wraps arrays and stuff with its own primitives, so I moved the kryo.register
calls (and the commands to send) over to Java
3.) I didn't specify UDP port for the client even though I should have.
4.) I was trying to send TCP message back to the server using the Connection
I received in the connected
event callback, but apparently instead of that, I was supposed to use client.sendTCP
instead of connection.sendTCP
.
@breskeby Exact same problem here. I'd thought I'd added default constructors to all registered classes, but there was one without. Adding a default constructor fixed it immediately.
Had the same issue. This solved it immediately.
From cai...@gmail.com on July 07, 2013 19:02:06
What steps will reproduce the problem?
Attachment: compare.jpg
Original issue: http://code.google.com/p/kryonet/issues/detail?id=34