Bugs in nio? I'm paranoid!

Hey! I made a thread over at gamedev about a problem I had with networking. One respons I got said that Java nio has bugs that has not been fixed. Is this really true? I find it strange, but he sounded pretty sure. Take a look: http://www.gamedev.net/topic/604811-how-common-is-data-errors-in-tcp/

Also, I started thinking about using some sort of networking library instead. I want to make an MMO that can support a few hunderd players, and I want to use TCP. I want something that just works so that I can get on with my game. I have looked a bit at Mina, and it seems nice. Any tips or suggestions?

While I can make a little sense out of Clojure, I doubt that having me stare at the code will help you in any fashion.

If you can make a stand-alone Java app that includes both the client and server then I’d be willing to run it on my system and see if the error shows itself. I’m sure others would too.

Ahem Now I’ve done pretty much networking, and keeping servers running java code for months without a crash. That was done with the basic I/O, and the custom NIO implementations in Mina, and later JBoss’ Netty. Haven’t experienced leaks of any sort related to the use of these packages. Of course you could’ve made a mistake yourself.

Also, the point that the Moderator made in that thread is really good. You don’t see errors in the data-transmission at all (unless you’re using UDP, and not handling things accordingly). I’ve also made dumps of several gigabytes because I wanted some media, and databases that i only could access through HTTP, and I’ve never ever experienced faults in the transmission.

I would be happy to run your code a couple of hours if it’s just a light daemon to test, if needed.

Cheers.

EDIT:
I haven’t used the NIO in java that’s provided a lot (a couple of weeks work tops), but I really don’t think you’d find these massive bugs in it. If unsure, just use Netty. It’s easier to use, and should provide better performance than Mina (I’ve seen some benchmarks of the same servers, with the different libraries, and the difference was slight, but big enough to notice if you’re handling 2k connected users).

Thanks for the replys. I think I’m better off with a framework anyway.

I was leaning towards Kryonet. Does anyone have experience with both Netty and Kryonet?

My first post here :stuck_out_tongue:

I’ve worked on RuneScape private servers before, and I’m currently working on a Minecraft server implementation, much like CraftBukkit. What I’ve found is that, no matter how hard you try, using libraries built on top of NIO isn’t what I want. I much prefer the ability to make it as lightweight and controllable as possible: that means, I like to just use my own implementation of the java.nio package. That goes without saying that Netty/MINA/etc. are bad, but I found myself uncomfortable with trying to “master” the usage of them at the cost of possibly using them wrong.

I looked up “java nio server example” on Google and found an even better one. I can’t link right now but you can try it yourself! I believe it was the fourth result on Google.

Being paranoid of bugs is quite OK – it’s understandable. However, I can assure you that I’ve used to java.nio lib as it is plenty of times and have yet to encounter and sort of error that was caused by the API and not by me messing something up.

KryoNet is my project. Netty is more widely used, so had more testing and has been deployed in production more. KryoNet probably has a much easier to use API, so easy that maybe you would save time by starting with KryoNet and switching if it became an issue. If you did use Netty, you could still use Kryo, the serialization portion of KryoNet, but you’d have to dive into Netty and wire it up.

KryoNet has been used by JGO’s Hsaka:
http://www.ttafo.com/afo.html
He says it has scaled to several hundred players.

My online game (http://www.ttafo.com/afo.html) has used KryoNet for almost 2 years now without any problems. Recently I ported both the client and the server to Netty mainly because I wanted to see how much my tiny server machine would scale. Unfortunately, I had to revert to the KryoNet version of the server and client after a day or so because a bunch of consistency problems, connection problems etc. started occurring as more people came online. (Probably my fault though, might have missed something in the docs…)

IMHO KryoNet is much easier to use and will get your project up and running quickly. The only downside for me is that the client must also use KryoNet, which means my J2ME version of AFO (JavaME is still alive in my market) can’t talk to the same server as the PC version without some hacking around…