Hello all,
Having some problems with sending an packet (with an int).
This is my code:
http://pastebin.com/UkRSK2zcThe problem is at line 12, where I'm getting following exception:
Exception in thread "Server" java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183)
at com.esotericsoftware.kryo.io.ByteBufferOutputStream.write(ByteBufferOutputStream.java:42)
at com.esotericsoftware.kryo.io.Output.flush(Output.java:154)
at com.esotericsoftware.kryonet.KryoSerialization.write(KryoSerialization.java:51)
at com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:192)
at com.esotericsoftware.kryonet.Connection.sendTCP(Connection.java:59)
at x.ServerHandler.sendTileData(ServerHandler.java:71)
at x.ServerHandler.received(ServerHandler.java:33)
at com.esotericsoftware.kryonet.Server$1.received(Server.java:61)
at com.esotericsoftware.kryonet.Connection.notifyReceived(Connection.java:246)
at com.esotericsoftware.kryonet.Server.update(Server.java:208)
at com.esotericsoftware.kryonet.Server.run(Server.java:356)
at java.lang.Thread.run(Thread.java:722)
I'm suspecting there is something going wrong with the x and y values. The buffer overflows are happening when the x value is > 70. I have no idea what is causing this.
The packet that is being sent is just int x, int y, String id.
Hope anyone can help.
Thanks