JBoss Netty

Not sure why I took so long to source a networking library for use at work. I've already wasted so many hours dealing with packet fragmentation, socket handling, and assorted bugs. (TCP isn't a great protocol for sending messages. I await SCTP adoption eagerly.)

Not only fragmentation, but dealing with simple stuff like reading and writing using Java NIO. ByteBuffer is oddly a hard class to use. Something about having to flip it around and whatnot. It's also fixed length buffer, which makes it pretty much inappropriate for serializing a variable length message.

I went with JBoss Netty on a project which handles framing, has a nice replacement for ByteBuffer, and a pretty simple and elegant architecture as well. And I managed to implement a replacement for an old bit of code in about two, three hours, just following the surprisingly good documentation and examples.

There are a couple of things to keep in mind. One is that all reads/writes are asynchronous and even closing the connection is asynchronous. Thus, you need to pay attention with the ordering.

Competing products Grizzly and MINA don't seem to be as simple or have the above features.

Read and post comments | Send to a friend

Advertisements

About eliasross

Blogging before the word "blog" was invented.
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s