net.anotheria.net.tcp.server
Class BasicTCPServer

java.lang.Object
  extended by net.anotheria.net.shared.server.AbstractServer
      extended by net.anotheria.net.tcp.server.BasicTCPServer
All Implemented Interfaces:
Runnable, IServer
Direct Known Subclasses:
O2OServer, TCPProxyServer

public class BasicTCPServer
extends AbstractServer
implements Runnable

A basic server for tcp connections.

Author:
lrosenberg

Constructor Summary
BasicTCPServer(int aPort, IConnectionFactory conFactory)
          Creates a new server with the given port and connection factory.
 
Method Summary
 boolean isRunning()
          Returns true if the server is running
 void run()
           
 void setRunning(boolean aRunning)
          Used to stop the server by stoping the thread.
 void startServer()
          Starts the server
 void stopServer()
          Stops the server.
 
Methods inherited from class net.anotheria.net.shared.server.AbstractServer
addServerListener, getConnectionFactory, notifyConnectionCreated, notifyConnectionRemoved, removeServerListener, setConnectionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTCPServer

public BasicTCPServer(int aPort,
                      IConnectionFactory conFactory)
Creates a new server with the given port and connection factory.

Parameters:
aPort - the port to listen to.
conFactory -
Method Detail

startServer

public void startServer()
                 throws ServerException
Description copied from interface: IServer
Starts the server

Specified by:
startServer in interface IServer
Throws:
ServerException

run

public void run()
Specified by:
run in interface Runnable

stopServer

public void stopServer()
Stops the server.

Specified by:
stopServer in interface IServer

isRunning

public boolean isRunning()
Returns true if the server is running

Returns:

setRunning

public void setRunning(boolean aRunning)
Used to stop the server by stoping the thread.

Parameters:
running - false if the server has to be stoped.


Copyright © 2010-2013 anotheria.net. All Rights Reserved.