Class ServerThread

java.lang.Object
  extended byjava.lang.Thread
      extended byServerThread
All Implemented Interfaces:
java.lang.Runnable

public class ServerThread
extends java.lang.Thread

This class handles ServerThread startup, operations and shutdown. Once a ServerThread is created, communications between client can occur. The ServerThread is passed information from the Server to communicate to the newly connected client.

Version:
2.0
Author:
3GP01 - Hardev Bhamra, Deepak Chandarana, James Tompkin
See Also:
Client, Server

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerThread(java.net.Socket clientSocket, ServerThread[] st, java.lang.String dictionary, int hints, int id, java.lang.String[] cNames)
          Creates a new ServerThread
 
Method Summary
 void close()
          Closes the ServerThread
 void echo(java.lang.String inputLine)
          Sends the inputLine to all clients.
 Scrabble getScrabble()
          Gets Scrabble instance.
 void kick()
          Echoes a kick request from the server lobby.
 void run()
           
 void sendDictionary(java.lang.String file)
          Streams a dictionary to the client, so that the client may receive the dictionary that the server wishes to use.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerThread

public ServerThread(java.net.Socket clientSocket,
                    ServerThread[] st,
                    java.lang.String dictionary,
                    int hints,
                    int id,
                    java.lang.String[] cNames)
Creates a new ServerThread

Parameters:
clientSocket - The socket with which to connect.
st - The ServerThread itself.
dictionary - The dictionary to be used in the game.
hints - The number of hints to be allowed in the game.
id - The uid of the client.
cNames - A list of current clients in the game.
Method Detail

getScrabble

public Scrabble getScrabble()
Gets Scrabble instance.

Returns:
Scrabble

run

public void run()

echo

public void echo(java.lang.String inputLine)
Sends the inputLine to all clients.

Parameters:
inputLine - The String to echo to all clients.

kick

public void kick()
Echoes a kick request from the server lobby.


close

public void close()
Closes the ServerThread


sendDictionary

public void sendDictionary(java.lang.String file)
Streams a dictionary to the client, so that the client may receive the dictionary that the server wishes to use.

Parameters:
file - The dictionary to send.