Why Use NIO?

The main advantage of using NIO over standard I/O streams is the fact that we can now create a non-blocking server, meaning that the server does not have to sit and wait to read a message from a stream. This also means that with TCP, we no longer require a separate thread for each individual client that connects to the server.

As you can guess, the main advantage from a games point of view is massively multiplayer games, where there can be hundreds or even thousands of connections at one time. This would be costly if we had to create several thousand individual threads to handle each of the players!



Java 1.4 Game Programming
Java 1.4 Game Programming (Wordware Game and Graphics Library)
ISBN: 1556229631
EAN: 2147483647
Year: 2003
Pages: 237

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net