0

I am having a very odd issue with the latest version of KryoNet. I'm sending a very simple packet from my client and my server, and getting the buffer underflow exception. I have 4 other registered packets, all of which work flawlessly. The packet that is getting the buffer underflow issue has two string variables, and has been tested with both TCP and UPD. The exception occurs when the packet is sent fairly quickly, atlest twice in under a second. Very odd considering I have other packets that are being updated 60 times a second.

This issue is very different from other buffer underflow issue's I've researched. This issue isn't caused from sending very large data, as the packet has only two String variables. This issue also isn't caused by an applet or some other configuration, as I'm running it as an Application currently using LibGDX.

Do you guys have any ideas on what could be causing this issue?

Thank you and I hope you've had a happy holiday, - Jake

SOURCE: https://github.com/SirTrashyton/SquareContest (The class I'm having issues with is Packet05Chat)

SirTrashyton
  • 173
  • 2
  • 3
  • 12

1 Answers1

0

After a few hours of testing I found a solution. As it turns out, KryoNet couldn't distinguish between object types. When I sent a String to the server containing something that would be like another object, I.E. an Integer, a Character, etc, KryoNet would parse the String very oddly and produce an error.

This was easily fixed by adding a suffix to the message, something random like "OK". Then when it was sent back by the server I'd replace 'OK' with nothing.

Hope this helps anyone else who is getting this error.

SirTrashyton
  • 173
  • 2
  • 3
  • 12