ClientServer Programming in Java


The Client/Server Model

The client/server model is the most common networking architecture employed in distributed applications. A server is a program (or collection of cooperating programs) that provides services and/or manages resources on the behalf of other programs, known as its clients. Figure 29-4 shows a typical client/server environment.

Figure 29-4. A simple client/server


A key advantage of the client/server approach is the ability for the server to control its clients by localizing important processing and data within itself. For example, in online games, decisions about the outcome of a player's actions (e.g., the shooting of a monster) will be made by the server. The alternative is to delegate this to the client's application, which may lead to abuse by hackers.

A central location for client data and processing makes it easier to monitor users, administer them, and charge them for game playing. These are significant benefits for commercial multiplayer gaming.

The server is an arbiter for conflicting client requests. For instance, it's impossible for two clients to update the same data state simultaneously.

Placing state information in one place makes changing it straightforward and avoids inconsistencies arising when updating multiple copies stored on clients.

Concentrating processing on the server side permits the client side to run on a less powerful machine, an important consideration for network applications on PDAs or phones.

Concentrating most of the application in the server makes it is easier to maintain and update, compared to upgrading code spread over a large, possibly nontechnical, user base.

The main disadvantage of a "fat" server is the potential for it to become a bottleneck, overloaded by too many clients, and increasing latency to unacceptable levels. Excessive numbers of clients may overload the server's data storage capacity.

Another significant issue is reliability in that if the server fails, then everyone will be affected. Almost as bad as failure is the (temporary) nonavailability of the server because it's currently dealing with too many users, due to a hacker attack, or it's been taken offline for servicing or upgrades.

These concerns have led to the widespread use of multiple servers, sometimes specialized for different elements of client processing, or acting as duplicates, ready to substitute for a server that fails. Different servers may be in different geographical locations, catering only to clients in those areas, which improves latency times.

Many MMORPGs map areas of their virtual world to different physical servers (e.g., Ultima Online). When clients move across a boundary in the world, they are switched to a different server. This acts as a form of load balancing, though its success depends on the different zones having roughly the same levels of popularity.

High-powered servers are expensive, especially ones with complex database management, transaction processing, security, and reliability capabilities.

A successful application (game) will require an expensive, high-speed Internet connection. A predicted trend is that gaming companies will start to offer their own backbone networks, giving them greater control over bandwidth, latency, and the specification of firewall access. This latter point will make it easier for applications to use multiple protocols (e.g., UDP for data, TCP for commands) without worrying about clients being unable to create the necessary communication links due to firewall restrictions.



Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

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