Chapter 20. Broadcasting


 
Network Programming with Perl
By Lincoln  D.  Stein
Slots : 1
Table of Contents
Chapter  19.   UDP Servers

    Content

Summary

The UDP protocol is ideal for lightweight message-oriented servers that do not require a high degree of reliability. The Internet chat system described in this chapter is a good example of such an application.

Although the chat system is fully functional, it lacks many features. For one thing, the system doesn't provide a way to notify you when a specific user logs in to the system (called a "hot list" in some systems). This feature would be straightforward to add. Another deficiency of the system is that it doesn't provide anything in the way of long- term user registration and authentication. Anyone can log in using any nickname, and as soon as the system is killed and restarted, all information on registered users is lost. The only consistency check performed by the system is to prevent two concurrent users from choosing the same nickname.

To support user authentication and persistent registration, you would have to add some sort of database backend to the system. Implementations could range in complexity from simple DBM files to sophisticated relational databases.

Last, several real-world chat systems provide Internet "relay" functionality. Instead of burdening a single chat server with the responsibility of managing all registered users, relay systems distribute the load among multiple servers. Messages and other events posted to one server are relayed to the other servers so that they can broadcast the event to their users. You could add this feature to the current implementation by having each server log in to the other servers as if it were a client. When a server receives an event from another server, it simply relays it to all its users, which might include a mixture of users and other servers. However, you'd have to write code to prevent events being ping-ponged in a never-ending loop.

Another way to reduce the burden on the chat server is to replace the current user-at-a-time method of sending events to a channel's enrollees with a system that sends the event to all enrollees with a single system call. This is the topic of Chapter 21.


   
Top


Network Programming with Perl
Network Programming with Perl
ISBN: 0201615711
EAN: 2147483647
Year: 2000
Pages: 173

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