be.ac.ulg.montefiore.run.totem.socketInterface
Class Server

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.socketInterface.Server

public class Server
extends java.lang.Object

Wait for clients on a socket interface. Receives scenario events from the socket interface, treat them and sends responses.

A call to start(.) method will create a new thread that waits for clients and a "consumer" to execute received scenario events.
When a client is connected, a "producer" thread is launched. It reads messages coming from socket and puts them in a queue. The consumer executes the events from the queue and sends the response to the client.

note: Multiple clients can be enabled by removing the call to producerThread.join() in the start method. but this was not tested.
note: Does not seem to stop correctly.

Creation date: 26 sept. 2006

Author:
Ga�l Monfort (monfort@run.montefiore.ulg.ac.be)

Nested Class Summary
static class Server.Input
          Simple structure to use in the message queue.
 
Field Summary
static int DEFAULT_PORT
           
 
Method Summary
static Server getInstance()
           
 void join()
          Waits for the server to finish execution.
 void start()
           
 void start(int port)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values
Method Detail

getInstance

public static Server getInstance()

start

public void start()
           throws java.io.IOException
Throws:
java.io.IOException

start

public void start(int port)
           throws java.io.IOException
Throws:
java.io.IOException

stop

public void stop()

join

public void join()
Waits for the server to finish execution.



Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.