|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Communicator
An interface that specifies methods for connecting to and communicating with a server.
Method Summary | |
---|---|
void |
close()
Used to close the communicator object, and free resources. |
boolean |
connect(java.lang.String[] addresses)
Connects to the server(s) with the specified address(es). |
void |
disconnect(java.lang.String[] addresses)
Disconnects from the specified address(es). |
void |
notifyAboutMessageReceived(java.lang.Object message)
Called when a message is received. |
void |
searchForNodes()
Searches for network nodes to connect to. |
void |
sendMessage(java.lang.Object message,
boolean confirm)
Called when the client's model wants to send a message using its Communicator instance. |
Method Detail |
---|
boolean connect(java.lang.String[] addresses)
addresses
- The address(es) to connect to.
void disconnect(java.lang.String[] addresses)
addresses
- The address(es) to disconnect from.void sendMessage(java.lang.Object message, boolean confirm)
Communicator
instance. This message
should be created by the MessageParser
implementation,
to ensure that the format of the message follow the specified format.
In implementations of this method, the confirm flag can be used to
implement guaranteed delivery of critical messages, similar to
that found in the TCP transport protocol.
message
- The message to send.confirm
- Whether receival of the message should be confirmed by the receiver.void notifyAboutMessageReceived(java.lang.Object message)
message
- The message that has been received.void close()
void searchForNodes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |