Class Broadcaster

Class Broadcaster

java.lang.Object
   |
   +----Broadcaster

class Broadcaster
extends Object
Shared broadcaster for the Chat Server - this object is shared by all the threads, it keeps track of all the output lines and broadcast messages to all clients.
Author:
Tomer Klainer
mandor@cs.huji.ac.il
See Also:
ChatServerThread

Constructor Index

 o Broadcaster()
create broadcaster with empty hash table

Method Index

 o add(int, PrintStream)
add client to hash table
 o broadcast(String)
broadcast message to all clients in table
 o remove(int)
remove client from hash table

Constructors

 o Broadcaster
  public Broadcaster()
create broadcaster with empty hash table

Methods

 o broadcast
  public void broadcast(String message)
broadcast message to all clients in table
Parameters:
message - the message
 o add
  public void add(int client_num,
                  PrintStream ps)
add client to hash table
Parameters:
client_num - id of the thread handling this client
ps - output stream to that client
 o remove
  public void remove(int client_num)
remove client from hash table
Parameters:
client_num - id of the thread handling this client