All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sics.agentbase.net.InternetServer

java.lang.Object
   |
   +----sics.agentbase.net.InternetServer

public abstract class InternetServer
extends Object
implements Runnable

Constructor Index

 o InternetServer(String, int)
Creates a new server with the specified name that listens on the specified port.
 o InternetServer(String, String, int)
Creates a new server with the specified name that listens on the specified port.

Method Index

 o deliverMessage(Message)
Delivers a message.
 o getHost()
 o getMessageDispatcher()
Returns the active message dispatcher.
 o getName()
 o getPort()
 o handleConnection(Socket)
handleConnection(Socket connection)
 o run()
 o setMessageDispatcher(MessageDispatcher)
Sets the message dispatcher for this server to use when delivering messages.
 o shutdown()
Shutdowns this server.

Constructors

 o InternetServer
 public InternetServer(String name,
                       int port) throws IOException
Creates a new server with the specified name that listens on the specified port. If the port is 0, any free port is used to listen on and the used port number can be accessed through getPort().

Parameters:
name - the name of the server.
port - the port to listen on.
 o InternetServer
 public InternetServer(String name,
                       String host,
                       int port) throws IOException
Creates a new server with the specified name that listens on the specified port. If the port is 0, any free port is used to listen on and the used port number can be accessed through getPort().

Parameters:
name - the name of the server.
host - the full host name of the local host.
port - the port to listen on.

Methods

 o shutdown
 public synchronized void shutdown() throws IOException
Shutdowns this server. Stops it from executing and releases the port.

 o run
 public void run()
 o getName
 public final String getName()
 o getPort
 public final int getPort()
 o getHost
 public final String getHost()
 o getMessageDispatcher
 public final MessageDispatcher getMessageDispatcher()
Returns the active message dispatcher.

Returns:
the active message dispatcher or null if no message dispatcher is set.
 o setMessageDispatcher
 public final synchronized void setMessageDispatcher(MessageDispatcher dispatcher)
Sets the message dispatcher for this server to use when delivering messages. If no message dispatcher is set, the default message dispatcher is used to deliver messages.

Parameters:
dispatcher - the message dispatcher to use when delivering messages.
See Also:
getDefaultMessageDispatcher
 o deliverMessage
 protected synchronized void deliverMessage(Message msg)
Delivers a message. Uses the default message dispatcher if no active message dispatcher has been set.

Parameters:
msg - the message to deliver.
See Also:
getDefaultMessageDispatcher
 o handleConnection
 protected abstract void handleConnection(Socket connection) throws IOException
handleConnection(Socket connection)


All Packages  Class Hierarchy  This Package  Previous  Next  Index