Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [KryoNet] - Incorrect Number of Bytes  (Read 2589 times)
0 Members and 1 Guest are viewing this topic.
Offline Liquidz

Junior Newbie





« Posted 2011-11-22 19:54:50 »

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...)


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
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/ Smiley

Pls help me ^^
Greetz Liquidz
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #1 - Posted 2011-11-22 21:17:54 »

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.

Offline Liquidz

Junior Newbie





« Reply #2 - Posted 2011-11-23 20:21:36 »

Hello Nate!
I will test the Example tomorrow. Smiley

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...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Liquidz

Junior Newbie





« Reply #3 - Posted 2011-11-25 16:06:39 »

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

Must the Applet be signed??
My Applet isn´t signed..^^
Offline Drakkheim

Senior Newbie





« Reply #4 - Posted 2012-01-18 23:24:28 »

Ran into this issue today.

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

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (34 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (31 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (44 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!