org.hprog.code
Class CodeThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.hprog.code.CodeThread
All Implemented Interfaces:
java.lang.Runnable

public class CodeThread
extends java.lang.Thread

Network communication thread for a particular client


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CodeThread(java.net.Socket sock)
           
 
Method Summary
 void run()
          Handle communication.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CodeThread

public CodeThread(java.net.Socket sock)
           throws CodeProtocol.Exn
Parameters:
sock - socket to use for communication
Method Detail

run

public void run()
Handle communication.
  • Starts a new timer to keep track of when the client last sent a message and close the connection if this time is ever too long ago.
  • Reads a SESSION command and loops reading LOGIN commands until a valid, unused handle is receieved
  • Sends client initial information
  • Goes into main loop dealing with protocol messages
  • Specified by:
    run in interface java.lang.Runnable
    Overrides:
    run in class java.lang.Thread