All Packages Class Hierarchy This Package Previous Next Index
Class Abstract.ServerThread
Abstract.Connection
|
+----Abstract.ServerThread
- public abstract class ServerThread
- extends Connection
ServerThread is a thread which accept() connection from the other
agents. Then it will generate ReceiverThread to receive and send message.
If the protocol and endWith character are not appropriate for your
system, you can use setEndWitn(char) method to define end with charecter.
ReceiverThread is just a thread for send/receive messages. No high level protocol is
assumed on the ReceiverThread.
- See Also:
- BRecvThread
-
_listenSocket
- ServerSocket object
-
_queue
- Message Queue normally passed from AgentAction object
-
ServerThread()
- Default constructor
-
ServerThread(Address, ConnectionTable, MessageBuffer, Security)
- Constructor using Address, ConnectionTable,MessageBuffer and Security objects.
-
getMessageQueue()
- Get message queue
-
getServerSocket()
- Get ServerSocket
-
run()
- Listening and waiting for connection.
-
setMessageQueue(MessageBuffer)
- Set message queue
-
setServerSocket(ServerSocket)
- Set ServerSocket for the ServerThread
_listenSocket
protected ServerSocket _listenSocket
- ServerSocket object
_queue
protected MessageBuffer _queue
- Message Queue normally passed from AgentAction object
- See Also:
- MessageBuffer
ServerThread
public ServerThread()
- Default constructor
ServerThread
public ServerThread(Address address,
ConnectionTable connections,
MessageBuffer mesg,
Security security) throws ConnectionException, UnknownHostException, IOException
- Constructor using Address, ConnectionTable,MessageBuffer and Security objects.
- Parameters:
- address - My address object which contains port number
- connections - connection table
- mesg - the message queue
- security - Security object which will be passed to the ReceiverThread
- Throws: ConnectionException,
- UnknownHostException, IOException
getMessageQueue
public MessageBuffer getMessageQueue()
- Get message queue
- Returns:
- MessageBuffer
setMessageQueue
public void setMessageQueue(MessageBuffer queue)
- Set message queue
- Parameters:
- queue - MessageBuffer
setServerSocket
public void setServerSocket(ServerSocket s)
- Set ServerSocket for the ServerThread
- Parameters:
- s - ServerSocket,opened for the ServerThread
getServerSocket
public ServerSocket getServerSocket()
- Get ServerSocket
- Returns:
- ServerSocket, which is listening
run
public void run()
- Listening and waiting for connection. If accepted, it will create ReceiverThread object.
ConnectionTable will be automatically updated by Security object
The generated client receiver thread should be a subclass of ReceiverThread.
Do not forget to set endWith character if the messages are not
ended with '\004'
All Packages Class Hierarchy This Package Previous Next Index