yasin1913 / kryonet

Automatically exported from code.google.com/p/kryonet
0 stars 0 forks source link

Problem with reconnecting to server #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 reported on code.google.com by konrad.p...@gmail.com on 11 Mar 2010 at 11:39

GoogleCodeExporter commented 8 years ago
Turns out the Client's buffers were not being reset properly. Fixed in SVN 31.

Thanks!

Original comment by nathan.s...@gmail.com on 11 Mar 2010 at 9:58