agentland.util
Class SocketServerAgent
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--metaglue.AgentAgent
|
+--agentland.util.GoodAgent
|
+--agentland.resource.ManagedAgent
|
+--agentland.util.SocketServerAgent
- public class SocketServerAgent
- extends ManagedAgent
- implements SocketServer
SocketServerAgent
implements a SocketListener and
SocketManager at the specified default port. Data of the correct
form: |[Message]\n
is announced via
processMsg
. (Where [Message] is the message to be
sent.
- See Also:
ManagedAgent
,
SocketServer
, Serialized Form
Method Summary |
int |
getDefaultPort()
Returns the default port on which the socket server should
listen. |
void |
listen(int port)
Specifies on which port to listen. |
void |
processMsg(String msg)
Announces the data from the socket, if it is in the form:
|[Message]\n . |
Methods inherited from class agentland.resource.ManagedAgent |
connect,
getAlert,
getNeed,
reliesOn,
reliesOn,
replace,
request,
request,
request,
requestAgent,
requestAgent,
resources,
resourcesByAgentID,
setNeed,
yank,
yank,
yank |
Methods inherited from class agentland.util.GoodAgent |
addSpy,
addSpy,
alert,
alertString,
beep,
error,
getHistory,
getHistoryElement,
getPersistentMap,
log,
notify,
removeSpy,
removeSpy,
resetHistory,
safeRely,
safeRely,
safeRely,
setNiceLogName,
tell |
Methods inherited from class metaglue.AgentAgent |
addMonitor,
alive,
defrost,
defrostAll,
defrostBoolean,
defrostInt,
defrostString,
fixAttribute,
fixAttribute,
freeze,
freeze,
freeze,
freezeAll,
freezeVar,
getAgentID,
getAttribute,
getCatalog,
getCatalogID,
getDesignation,
getFrozenVariables,
getLogLevel,
getMetaglueAgent,
getMetaglueAgentID,
getOccupation,
getProperties,
getSociety,
log,
log,
obtainMetaglueAgent,
obtainMetaglueAgent,
obtainMetaglueAgentByName,
reliesOn,
reliesOnSynch,
removeFrozen,
replaceExceptionHandler,
setFreezeName,
setLogLevel,
setLogName,
shutdown,
startAgent,
startAgentOn,
startAgentOn,
startup,
status,
tiedTo,
tiedTo,
tiedTo,
tiedTo,
tieToDesignation,
whereAreYou |
SocketServerAgent
public SocketServerAgent(int port)
throws RemoteException
SocketServerAgent
public SocketServerAgent()
throws RemoteException
listen
public void listen(int port)
throws RemoteException
- Specifies on which port to listen.
- Specified by:
- listen in interface SocketServer
- Parameters:
port
- an int
value- Throws:
- RemoteException - if an error occurs
getDefaultPort
public int getDefaultPort()
throws RemoteException
- Returns the default port on which the socket server should
listen. Overrided in subclasses.
- Specified by:
- getDefaultPort in interface SocketServer
- Returns:
- an
int
value - Throws:
- RemoteException - if an error occurs
processMsg
public void processMsg(String msg)
throws RemoteException
- Announces the data from the socket, if it is in the form:
|[Message]\n
. Announcement is made
through System.out. Is Overrided in subclasses.
- Specified by:
- processMsg in interface SocketServer
- Parameters:
msg
- a String
value- Throws:
- RemoteException - if an error occurs