UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.net
Class ClientRegistry

java.lang.Object
  |
  +--edu.berkeley.guir.lib.net.ClientRegistry

public class ClientRegistry
extends Object

A collection of clients registered with the ClientRegistryServer.

The clients and the registry communicate via a simple protocol. First four bytes are size of payload. Rest of bytes is payload.

 Revisions:  - GUIRLib-v1.2-1.0.0, Jul 19 2000, JH
               Created class
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
JDK 1.3
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )

Constructor Summary
ClientRegistry()
           
 
Method Summary
 int addClient(Socket conn)
          Add a client to the registry.
 void clearClients()
          Clear out the clients.
static int getNextUniqueID()
          Returns an ID for clients.
 void removeClient(int id)
          Remove a client from the registry.
 void sendAll(byte[] bytes)
          Send a message to all clients asynchronously.
 void sendTo(int id, byte[] bytes)
          Send a message to a specific client asynchronously.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientRegistry

public ClientRegistry()
Method Detail

getNextUniqueID

public static int getNextUniqueID()
Returns an ID for clients.

sendTo

public void sendTo(int id,
                   byte[] bytes)
Send a message to a specific client asynchronously.

sendAll

public void sendAll(byte[] bytes)
Send a message to all clients asynchronously.

addClient

public int addClient(Socket conn)
Add a client to the registry.
Returns:
the ID assigned to the client.

removeClient

public void removeClient(int id)
Remove a client from the registry.

clearClients

public void clearClients()
Clear out the clients.

Copyright Information