Algernon Software

org.algernon.server
Class AlgernonServer

java.lang.Object
  extended byorg.algernon.server.AlgernonServer
All Implemented Interfaces:
Runnable

public class AlgernonServer
extends Object
implements Runnable


Nested Class Summary
(package private)  class AlgernonServer.SocketConnectionHandler
          Socket connection handler runs on its thread to handle one client connection.
 
Field Summary
private  Algernon f_algy
           
private  Vector f_handlers
           
private  boolean f_isRunning
           
private  int f_portNumber
           
private  ServerSocket f_socket
           
 
Constructor Summary
AlgernonServer(Algernon algy, int portNumber)
          Create a new AlgernonServer.
 
Method Summary
 int getPortNumber()
          Returns the current port number.
 boolean isRunning()
          Returns true if the server is running.
 void run()
          Called by start().
 void start()
          Starts the algernon server, it runs on a new thread.
 void stop()
          Stops the algernon server thread.
private  void stopAlgernonServer()
           
protected  void tell(String tellStr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

f_algy

private Algernon f_algy

f_portNumber

private int f_portNumber

f_isRunning

private boolean f_isRunning

f_socket

private ServerSocket f_socket

f_handlers

private Vector f_handlers
Constructor Detail

AlgernonServer

public AlgernonServer(Algernon algy,
                      int portNumber)
Create a new AlgernonServer. It does not automatically start running, until its start() method is called.

Method Detail

isRunning

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


getPortNumber

public int getPortNumber()
Returns the current port number.


start

public void start()
Starts the algernon server, it runs on a new thread.


stop

public void stop()
Stops the algernon server thread.


run

public void run()
Called by start(). Performs only tells. Input must be on one line, terminated by a newline.

Specified by:
run in interface Runnable

tell

protected void tell(String tellStr)

stopAlgernonServer

private void stopAlgernonServer()
                         throws IOException
Throws:
IOException

Algernon Software