If you have your own set of classes that handle all IO in your app, it might be better to make both client and server NIO, as you can reuse your code.

Leaving aside the "is NIO a better API generally?" issue (since I believe it is, but the bugs have been upsetting me recently), I'd like to underline the above with a comment from the GDC a few years ago, which went something like:

"If there's one thing you're going to do in writing a networked game, make sure you re-use as much code from the server as possible in the client. At the very least, write all the code for both in the same file, preferably in the same method as often as possible. That does more to reduce protocol implementation bugs than anything else"

This was at a roundtable with circa 40 people, most of whom had shipped at least one networked game. Pretty much everyone chimed in to agree wholeheartedly with that.

I managed to scrounge up a really nice client/server NIO chat application sample (courtesy of PKWooster) using Swing for the client and now I'm all up and running! Everything sort of makes sense when you take a working example app and recopy it line-for-line!

Now I just need to integrate JOGL into the client, which should be simple compared to the last day or so!

HAving said that. IF I had written generic NIO handling code and reduced both clietn and server to calls through a common API, I might very well use it everywhere in my project. If not though then there is no value to having with NIO on both sides as the resulting code is likely to be as different as anything yould write with java.net.

It can save you a LOT of grief though to encapsulate your communications protocol and put it ina single place.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org