org.deken.game.io
Class AbstractServer

java.lang.Object
  extended by org.deken.game.io.AbstractServer
All Implemented Interfaces:
java.lang.Runnable

public abstract class AbstractServer
extends java.lang.Object
implements java.lang.Runnable

Title: AbstractServer

Description: TODO

Copyright: Copyright (c) 2006

Version:
1.0
Author:
Gary Deken

Field Summary
static int DEFAULT_PORT
           
protected  java.net.ServerSocket listener
           
protected  int port
           
protected  java.lang.Thread thread
           
 
Constructor Summary
AbstractServer(int portNo)
           
 
Method Summary
protected abstract  void createService(java.net.Socket socket)
          createService
static void fail(java.lang.Exception e, java.lang.String msg)
           
 void run()
          run
 void start()
          start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

port

protected int port

listener

protected java.net.ServerSocket listener

thread

protected java.lang.Thread thread
Constructor Detail

AbstractServer

public AbstractServer(int portNo)
Method Detail

fail

public static void fail(java.lang.Exception e,
                        java.lang.String msg)

start

public final void start()
start

Start this thread.


run

public void run()
run

The main workhorse of the server thread. It listens for an accepts connections from clients.

Specified by:
run in interface java.lang.Runnable

createService

protected abstract void createService(java.net.Socket socket)
createService

Creates a service with the specified Socket.

Parameters:
socket - Socket