com.eriksilkensen.net
Class Server.ClientHandler

java.lang.Object
  extended by com.eriksilkensen.net.Server.ClientHandler
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
Server

public class Server.ClientHandler
extends java.lang.Object
implements java.lang.Runnable

Inner Class to handle the Clients. This involves connecting them to the Server, and knowing when to send out the messages to everyone listening.


Field Summary
protected  java.io.BufferedReader reader
           
protected  java.net.Socket sock
           
 
Constructor Summary
Server.ClientHandler(java.net.Socket clientSocket)
          Constructor for the Client Handler that sets everything up for the specified client Socket.
 
Method Summary
 void run()
          Runs when the Client Handler is registered as a job for a Thread, and the Thread is started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

protected java.io.BufferedReader reader

sock

protected java.net.Socket sock
Constructor Detail

Server.ClientHandler

public Server.ClientHandler(java.net.Socket clientSocket)
Constructor for the Client Handler that sets everything up for the specified client Socket.

Parameters:
clientSocket - the Client
Method Detail

run

public void run()
Runs when the Client Handler is registered as a job for a Thread, and the Thread is started. Waits around for a message to send, and when it gets one, it goes ahead and sends it. It also knows what to do if it sees a "quit*" message come through, which makes the whole process go quite smoothly.

Specified by:
run in interface java.lang.Runnable