ocsftester
Class  SimpleServer
java.lang.Object
  |
  +--ocsf.server.AbstractServer
        |
        +--ocsftester.SimpleServer
- public class SimpleServer- extends AbstractServer
The  SimpleServer  class is a simple subclass
 of the  ocsf.server.AbstractServer  class.
 It allows testing of the functionalities offered by the
 OCSF framework. The  java.awt.List  instance
 is used to display informative messages. This list is red
 when the server is closed, yellow when the server is stopped
 and green when open.
- See Also: 
- AbstractServer
| Field Summary | 
| private  java.awt.List | liste
 | 
 
 
| Constructor Summary | 
| SimpleServer(int port,
             java.awt.List liste)Creates a simple server.
 | 
| SimpleServer(java.awt.List liste)Creates a simple server.
 | 
 
| Method Summary | 
| protected  void | clientConnected(ConnectionToClient client)Hook method called each time a new client connection is
 accepted.
 | 
| protected  void | clientDisconnected(ConnectionToClient client)Hook method called each time a client disconnects.
 | 
| protected  void | clientException(ConnectionToClient client,
                java.lang.Throwable exception)Hook method called each time an exception is thrown in a
 ConnectionToClient thread.
 | 
| protected  void | handleMessageFromClient(java.lang.Object msg,
                        ConnectionToClient client)Handles a command sent from one client to the server.
 | 
| protected  void | listeningException(java.lang.Throwable exception)Hook method called when the server stops accepting
 connections because an exception has been raised.
 | 
| protected  void | serverClosed()Hook method called when the server is clased.
 | 
| protected  void | serverStarted()Hook method called when the server starts listening for
 connections.
 | 
| protected  void | serverStopped()Hook method called when the server stops accepting
 connections.
 | 
 
| Methods inherited from class ocsf.server.AbstractServer | 
| close, 
getClientConnections, 
getNumberOfClients, 
getPort, 
isListening, 
listen, 
receiveMessageFromClient, 
run, 
sendToAllClients, 
setBacklog, 
setPort, 
setTimeout, 
stopListening | 
 
| Methods inherited from class java.lang.Object | 
| , 
clone, 
equals, 
finalize, 
getClass, 
hashCode, 
notify, 
notifyAll, 
registerNatives, 
toString, 
wait, 
wait, 
wait | 
 
liste
private java.awt.List liste
SimpleServer
public SimpleServer(java.awt.List liste)
- Creates a simple server. The default port is 12345.- 
- Parameters:
- liste- the liste on which information will be displayed.
 
SimpleServer
public SimpleServer(int port,
                    java.awt.List liste)
- Creates a simple server.- 
- Parameters:
- port- the port on which the server will listen.
- liste- the liste on which information will be displayed.
 
clientConnected
protected void clientConnected(ConnectionToClient client)
- Hook method called each time a new client connection is
 accepted.- 
- Parameters:
- client- the connection connected to the client.
- Overrides:
- clientConnected in class AbstractServer
 
clientDisconnected
protected void clientDisconnected(ConnectionToClient client)
- Hook method called each time a client disconnects.- 
- Parameters:
- client- the connection with the client.
- Overrides:
- clientDisconnected in class AbstractServer
 
clientException
protected void clientException(ConnectionToClient client,
                               java.lang.Throwable exception)
- Hook method called each time an exception is thrown in a
 ConnectionToClient thread.- 
- Parameters:
- client- the client that raised the exception.
- Throwable- the exception thrown.
- Overrides:
- clientException in class AbstractServer
 
listeningException
protected void listeningException(java.lang.Throwable exception)
- Hook method called when the server stops accepting
 connections because an exception has been raised.- 
- Parameters:
- exception- the exception raised.
- Overrides:
- listeningException in class AbstractServer
 
serverStopped
protected void serverStopped()
- Hook method called when the server stops accepting
 connections.- 
- Overrides:
- serverStopped in class AbstractServer
 
serverClosed
protected void serverClosed()
- Hook method called when the server is clased.- 
- Overrides:
- serverClosed in class AbstractServer
 
serverStarted
protected void serverStarted()
- Hook method called when the server starts listening for
 connections.- 
- Overrides:
- serverStarted in class AbstractServer
 
handleMessageFromClient
protected void handleMessageFromClient(java.lang.Object msg,
                                       ConnectionToClient client)
- Handles a command sent from one client to the server.- 
- Parameters:
- msg- the message sent.
- client- the connection connected to the client that
  sent the message.
- Overrides:
- handleMessageFromClient in class AbstractServer