This sample is a multiplayer 2D game. the communication between the server and client is the UDP socket. the UDP socket communication will be much faster compared to the TCP socket. but it will not guarantee the data will not lose and in the correct order. so we shoshould consider using UDP data transfer for some un-critical data, and there was no effect on the game play even some data was lost. to handle the problem of stored ed data may not in order, we labeled the data with a sequence number.
Here the armywar server will also run the game logic: Moving the player with some velocity, check whether a bullet hit the player, whether the player catch the flag and win the match; at the end of each frame, it will broadcast each player Delta frame information to all players. of course, there are also some code there about register new player, login into the game lolobby, create a new room to start the game.
Armywar client will handle input and send USER command to the server. the client will predict the player new position (this will produce an immediate response with the user input), sync and correct the predicted result with the server.
The above is the screen shot about the this sample. you cocould found the source code from here. you need to install OpenGL library and MySQL (you cocould found my version from here) to run it. one more thing that need to mention here is that I got the source code from the book text and the textures were just some place holders.