ks.common.network
Class SimpleServerConnection

java.lang.Object
  extended byks.common.network.SimpleServerConnection
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Runnable

public abstract class SimpleServerConnection
extends java.lang.Object
implements java.lang.Runnable, java.lang.Cloneable

Base class to manage the server-side of a Socket connection.


Method Summary
 void close()
           
 CommunicationAgent getAgent()
           
abstract  void handleSession(CommunicationAgent agent)
          Subclasses should provide their own handler for new data appearin on the input
 boolean isConnected()
           
 boolean isRunning()
           
 void killServer()
          Forces a manual shutdown of the original ServerSocket.
 void run()
           
 void shutdown()
          Cleanly shutdown connection.
 boolean start()
          Start listening on the default port.
 boolean start(int thePort)
          Start listening on the given port.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAgent

public CommunicationAgent getAgent()

close

public void close()

handleSession

public abstract void handleSession(CommunicationAgent agent)
Subclasses should provide their own handler for new data appearin on the input

Parameters:
agent - Agent managing the communication session.

isConnected

public boolean isConnected()

isRunning

public boolean isRunning()

killServer

public void killServer()
Forces a manual shutdown of the original ServerSocket.


run

public void run()
Specified by:
run in interface java.lang.Runnable

shutdown

public void shutdown()
Cleanly shutdown connection.


start

public boolean start()
Start listening on the default port.

Returns:
true when connection is valid.

start

public boolean start(int thePort)
Start listening on the given port.

Parameters:
thePort -
Returns:
true when connection is valid.