net.jetrix.listeners
Class ClientListener

java.lang.Object
  extended by net.jetrix.services.AbstractService
      extended by net.jetrix.listeners.ClientListener
All Implemented Interfaces:
Runnable, Listener, Service
Direct Known Subclasses:
IRCListener, TetrinetListener

public abstract class ClientListener
extends AbstractService
implements Listener

Abstract Listener waiting for incomming clients.

Version:
$Revision: 536 $, $Date: 2004-12-18 01:12:51 +0100 (sam., 18 déc. 2004) $
Author:
Emmanuel Bourg

Field Summary
protected  int port
           
 
Fields inherited from class net.jetrix.services.AbstractService
autoStart
 
Constructor Summary
ClientListener()
           
 
Method Summary
abstract  Client getClient(Socket socket)
          Initialize a client from a socket.
 int getPort()
          Return the listening port.
 boolean isRunning()
          Tell if the service is currently running.
 void run()
          Main loop waiting for clients and checking basic rules (nickname unicity, ban list, room left on the server).
 void setPort(int port)
          Set the port used the next time the listener is started.
 void start()
          Start the listener.
 void stop()
          Stop the listener.
 String toString()
           
 
Methods inherited from class net.jetrix.services.AbstractService
isAutoStart, setAutoStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.jetrix.Listener
getName
 
Methods inherited from interface net.jetrix.Service
isAutoStart, setAutoStart
 

Field Detail

port

protected int port
Constructor Detail

ClientListener

public ClientListener()
Method Detail

getClient

public abstract Client getClient(Socket socket)
                          throws Exception
Initialize a client from a socket.

Throws:
Exception

run

public final void run()
Main loop waiting for clients and checking basic rules (nickname unicity, ban list, room left on the server). Newly created clients are then forwarded to the main server queue for channel assignation.

Specified by:
run in interface Runnable

getPort

public int getPort()
Description copied from interface: Listener
Return the listening port.

Specified by:
getPort in interface Listener

setPort

public void setPort(int port)
Description copied from interface: Listener
Set the port used the next time the listener is started.

Specified by:
setPort in interface Listener

start

public void start()
Start the listener.

Specified by:
start in interface Listener
Specified by:
start in interface Service

stop

public void stop()
Stop the listener.

Specified by:
stop in interface Listener
Specified by:
stop in interface Service

isRunning

public boolean isRunning()
Description copied from interface: Service
Tell if the service is currently running.

Specified by:
isRunning in interface Service

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2008 Emmanuel Bourg. All Rights Reserved.