The Revolution in Java's I/O LibrariesOverview of the JDK 1.4 NIO LibrariesChannelsInterfacesClassesServerSocketChannelSocketChannelDatagramChannelBuffersClassesFilling and DrainingManipulating BuffersDirect Versus NondirectSelectors and SelectionKeysChatterBox, A Basic Multi-Player ApplicationThe Server: ChatterServerInitial SetupThe Main LoopAccepting ConnectionsWriting MessagesReading MessagesDisconnectionsBuilding and Running the ServerConnecting with TelnetThe Client: ChatterClientSetupMaking the ConnectionThe Main LoopSending and Receiving MessagesBuilding and Running the ClientMulti-Player Game Server FrameworkDesign Goals and TacticsThe DesignGameEventsSerialized Java ObjectsXMLCustom BinaryBinary-Encoded XMLTerminologyClass DiagramsCommon Classes and InterfacesGameEvent InterfaceGameEventDefaultOver-the-Wire Event ProtocolServer ImplementationGameServer and GameControllerSelectAndReadGameControllersEventWriterThe ClientA Sample Game: RPS (Rock, Paper, Scissors)ClassesRPSControllerRPSGameRPSClientRPSConsoleEventReaderRunning the RPS GameComplete the Look: Building on the FrameworkClient GUIPersistenceBuddy Lists, Lobbies, and ChatServer AdministrationLoggingStartup/ShutdownJava Shutdown HooksServer Admin ConsolesGame WatchingAdvanced TopicsDisconnects and ReconnectsPing EventsThe ReaperHTTP TunnelingOption 1: Combo-ServerOption 2: URL-Based Load BalancingTesting with BotsThose Pesky ModemsProfiling and Performance StatsPerformance TweaksThe Evil Trash CollectorObject ReuseOther TweaksSummary