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
-
InternetServer(String, int)
- Creates a new server with the specified name that listens on the
specified port.
-
InternetServer(String, String, int)
- Creates a new server with the specified name that listens on the
specified port.
-
deliverMessage(Message)
- Delivers a message.
-
getHost()
-
-
getMessageDispatcher()
- Returns the active message dispatcher.
-
getName()
-
-
getPort()
-
-
handleConnection(Socket)
- handleConnection(Socket connection)
-
run()
-
-
setMessageDispatcher(MessageDispatcher)
- Sets the message dispatcher for this server to use when delivering
messages.
-
shutdown()
- Shutdowns this server.
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.
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.
shutdown
public synchronized void shutdown() throws IOException
- Shutdowns this server.
Stops it from executing and releases the port.
run
public void run()
getName
public final String getName()
getPort
public final int getPort()
getHost
public final String getHost()
getMessageDispatcher
public final MessageDispatcher getMessageDispatcher()
- Returns the active message dispatcher.
- Returns:
- the active message dispatcher or
null if no
message dispatcher is set.
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
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
handleConnection
protected abstract void handleConnection(Socket connection) throws IOException
- handleConnection(Socket connection)
All Packages Class Hierarchy This Package Previous Next Index