Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Writing a client using NIO  (Read 1758 times)
0 Members and 1 Guest are viewing this topic.
Offline JackalSama

Junior Newbie





« Posted 2005-09-03 21:36:54 »

Thought I'd put this in a separate topic!

I've seen a bunch of links describing how to use NIO to write servers.  Are there any similar resources for making clients?  Is NIO even worthwhile to use to write clients?   Huh

Thanks! Cheesy
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 743
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2005-09-03 22:03:42 »

NIO is not needed client-side for performance-reasons for networking.

One might argue it's a better designed API than the old IO API and results in better code. It has however a steep learning-curve and a few obscure bugs (ask Blah3h).

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.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2005-09-04 05:49:45 »

I wouldn't even buy thast it's a better API, other then the ByteBuffers which are nice but again only become a big deal when tryign to scale.

MNy advice is use java.net for your client unless you have a pressing reason not to.

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!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #3 - Posted 2005-09-04 11:07:43 »

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.

malloc will be first against the wall when the revolution comes...
Offline JackalSama

Junior Newbie





« Reply #4 - Posted 2005-09-05 02:06:24 »

Thanks for the help everyone!

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!  Wink

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

JGO Coder




Got any cats?


« Reply #5 - Posted 2005-09-05 05:25:51 »

Truisms are generally wrong.  Grin

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!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #6 - Posted 2005-09-05 09:38:06 »

Truisms are generally wrong.  Grin

Yeah, fair enough. But it's something I always bear in mind, and don't make the decision to split them lightly.

malloc will be first against the wall when the revolution comes...
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (18 views)
2014-07-24 01:59:36

Riven (17 views)
2014-07-23 21:16:32

Riven (14 views)
2014-07-23 21:07:15

Riven (17 views)
2014-07-23 20:56:16

ctomni231 (45 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!