com.ch.odi.net
Class PortListenerThread

java.lang.Object
  |
  +--com.ch.odi.net.PortListener
        |
        +--com.ch.odi.net.PortListenerThread

public class PortListenerThread
extends PortListener
implements Runnable

Description: Wraps a PortListener into its own thread. When the thread is started the underlying PortListener's listen method is called. Usage: Thread webServer = new Thread(new PortListenerThread(80, new WebServer())); webServer.start();


Constructor Summary
PortListenerThread(int port, ConnectionHandler handler)
          Creates a new PortListenerThread
 
Method Summary
 void run()
          Starts listening.
 
Methods inherited from class com.ch.odi.net.PortListener
listen, setConnectionHandler, setPort, stopListening
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortListenerThread

public PortListenerThread(int port,
                          ConnectionHandler handler)
Creates a new PortListenerThread
Parameters:
port - The TCP port to listen on
handler - The custom handler object to handle incoming connections
Method Detail

run

public void run()
Starts listening. Calles by the Thread object.
Specified by:
run in interface Runnable