Client/Server
Client/server connections work much differently than peer-to-peer.
This type of connection uses a specific device as the central access
and connection point for the network. A server is a machine that
manages the resources the clients connect to and access and pro
-
vides information to clients about the network and those connected
to it. In other words, clients do not have to connect to one another
but only to the server. For example, a gaming console can be a client
that connects to a server to play a game. All gamers connect to the
server, and send information to and receive information from the
server. The server is responsible for sending information to all
gamers in a game, not each individual gamer to one another. So
when a server receives information from a client that the other cli
-
ents need to be aware of, the server dispatches that information to
all gamers in the game.
The server can be a user’s machine or a dedicated piece of hard-
ware. Dedicated servers are machines whose sole purpose is to
provide access to information, while a user’s machine acts as both
the server and that player’s client. That means a dedicated server
does not have someone playing the game in front of the machine but
rather allows other machines to connect to it. In fact, most dedi-
cated servers are not graphical applications like the ones we use to
play the game and do not display any rendered scenes to the screen.
Since dedicated servers are stand-alone applications that operate
independently outside of configurations, monitoring, etc., there is
no need to render anything.
Using a game as an example, imagine a server that has all of the
information about a player such as their position, orientation, health,
etc. Whenever this information changes, the server sends this
updated data to the gamers connected to the game. Whenever the
player does something to alter his or her own data, the client sends
this information to the server, which then passes it along to the
other gamers. What exactly the client can send to the server
depends on how you design the networking portion of your game.
Using a server allows for enhanced security measures while
playing a game. For example, if a player is only able to send limited
information such as its input device state (e.g., Xbox 360 controller
state) to the server, then the server can use that information to
update the player in the game world by moving the player,
454 Chapter 14

Get Essential XNA Game Studio 2.0 Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.