[KryoNet] - Incorrect Number of Bytes

Hello Community!

I´m very new in things with Networking.
A few week ago i started to develop a mulitplayer Online Game.
I began this game as an Application but yesterday i changed it to an Applet.
Since the Change i become the following Error from KryoNet: (Sorry for my English…)

00:00  INFO: Connecting: /81.88.24.240:13030
00:00 ERROR: [kryonet] Error updating connection.
com.esotericsoftware.kryo.SerializationException: Incorrect number of bytes (1 remaining) used to deserialize object: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP@d75415
	at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:148)
	at com.esotericsoftware.kryonet.Client.update(Client.java:254)
	at com.esotericsoftware.kryonet.Client.run(Client.java:332)
	at java.lang.Thread.run(Unknown Source)
Exception in thread "Client" com.esotericsoftware.kryo.SerializationException: Incorrect number of bytes (1 remaining) used to deserialize object: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP@d75415
	at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:148)
	at com.esotericsoftware.kryonet.Client.update(Client.java:254)
	at com.esotericsoftware.kryonet.Client.run(Client.java:332)
	at java.lang.Thread.run(Unknown Source)
java.net.SocketTimeoutException: Connected, but timed out during TCP registration.
Note: Client#update must be called in a separate thread during connect.
	at com.esotericsoftware.kryonet.Client.connect(Client.java:178)
	at com.esotericsoftware.kryonet.Client.connect(Client.java:115)
	at de.liquidz.poke2d.state.LoadScreen.init(LoadScreen.java:41)
	at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
	at org.newdawn.slick.AppletGameContainer$Container.initApplet(AppletGameContainer.java:272)
	at org.newdawn.slick.AppletGameContainer$ContainerPanel.initGL(AppletGameContainer.java:229)
	at org.newdawn.slick.AppletGameContainer$ContainerPanel.start(AppletGameContainer.java:216)
	at org.newdawn.slick.AppletGameContainer$1.run(AppletGameContainer.java:92)

You can try it yourself at http://forum.projects-dw.de/lala/game/ :slight_smile:

Pls help me ^^
Greetz Liquidz

Somehow you are doing something wrong. :wink: The error means it received an object made up of X bytes. It deserialized these bytes and ended up with some bytes (1) left over. Do the KryoNet examples work for you? If so, compare and see what you are doing differently.

Hello Nate!
I will test the Example tomorrow. :slight_smile:

But, what does the Error exactly means?

For me he says that any of the registered Classes are different.
But I have 100% the same registered Classes in Client and Server…

I have tested it now with the standard code same Error…

Must the Applet be signed??
My Applet isn´t signed…^^

Ran into this issue today.

Solution:
you must register the classes on the Client and Server IN EXACTLY the same order.