EsotericSoftware / kryonet

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

Problem with reconnecting to server #3

Closed ghost closed 10 years ago

ghost commented 10 years ago

From konrad.p...@gmail.com on March 11, 2010 12:39:40

What steps will reproduce the problem?

  1. Create simple class for testing Client client = new Client(10000,10000); client.start(); while (true){ if(client.isConnected() == false){ try { client.connect(5000, "5.65.32.105", 54555, 54777); } catch (IOException ex) { // host not found } } try { Thread.sleep(5000); } catch (InterruptedException ex) { // sleep interrupted } }
  2. Client program is trying to maintain connection to server
  3. close and start server What is the expected output? What do you see instead? expected result would be client reconnecting to server instead we get following exception: 00:00 INFO: [kryonet] Connection 1 connected: /5.65.32.105 00:03 INFO: [kryonet] Connection 1 disconnected. 00:23 ERROR: [kryonet] Error updating connection. com.esotericsoftware.kryo.SerializationException: Invalid object length: 0 Exception in thread "Client" com.esotericsoftware.kryo.SerializationException: Invalid object length: 0 at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:110) at com.esotericsoftware.kryonet.Client.update(Client.java:197) at com.esotericsoftware.kryonet.Client.run(Client.java:251) at java.lang.Thread.run(Thread.java:619) at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:110) at com.esotericsoftware.kryonet.Client.update(Client.java:197) at com.esotericsoftware.kryonet.Client.run(Client.java:251) at java.lang.Thread.run(Thread.java:619) What version of the product are you using? On what operating system? 0.93 Please provide any additional information below.

Original issue: http://code.google.com/p/kryonet/issues/detail?id=2

ghost commented 10 years ago

From nathan.s...@gmail.com on March 11, 2010 13:58:08

Turns out the Client's buffers were not being reset properly. Fixed in SVN 31.

Thanks!

Status: Fixed