[multicast PIC] Chapter 30.   Network Chat


Three versions of a network chat application are developed in this chapter.

  1. Threaded TCP Clients and Server.
    The server uses threads to communicate with its clients, and a shared object to maintain client information. Each client employs a thread to watch for server communications (typically copies of other users' messages).
  2. UDP Multicasting Clients and a Name Server.
    The clients send messages to each other via UDP multicasting. However, a client wishing to join the chat group must first communicate with a name server which sends it the group address (or rejects the request). A departing client must notify the name server, so that it can maintain a current list of participants. A client wanting a list of other users sends a message to the server, rather than querying the group.
  3. Clients using a Servlet as a Server.
    The clients communicate with a chat servlet, sending messages as arguments of the servlet's URL. The servlet maintains client information, which is shared between the multiple threads executing inside the servlet instance. Each client has a separate thread which periodically queries the servlet for any new messages.

These examples illustrate the features of client/server models, peer-to-peer, and HTTP tunneling respectively, mechanisms first introduced in Chapter 29.




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page