|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectclient.framework.network.ClientSocketCommunicator
public class ClientSocketCommunicator
This class is a Communicator
object that
communicates using SocketConnection
or
UDPDatagramConnection
objects for its communication,
dependent of whether the transport protocol in use is
TCP or UDP, respectively.
Nested Class Summary | |
---|---|
protected class |
ClientSocketCommunicator.SenderThread
Thread responsible for sending messages to the server. |
Field Summary | |
---|---|
protected ClientSocketCommunicator.SenderThread |
sender
|
Constructor Summary | |
---|---|
ClientSocketCommunicator(AbstractGame abstractGame,
int packetSize)
Creates a ClientSocketCommunicator object. |
Method Summary | |
---|---|
void |
close()
Called when the connection is closed. |
boolean |
connect(java.lang.String[] addresses)
Connects to the specified address(es). |
void |
disconnect(java.lang.String[] adresses)
Not implemented. |
void |
notifyAboutMessageReceived(java.lang.Object message)
Called when the receiver thread has received a message. |
void |
searchForNodes()
Not implemented. |
void |
sendMessage(java.lang.Object message,
boolean confirm)
Sends the specified message to the server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ClientSocketCommunicator.SenderThread sender
Constructor Detail |
---|
public ClientSocketCommunicator(AbstractGame abstractGame, int packetSize)
ClientSocketCommunicator
object.
abstractGame
- The model with which the communicator communicates locallypacketSize
- The size of the UDP data packets (not used for TCP communication)Method Detail |
---|
public boolean connect(java.lang.String[] addresses)
connect
in interface Communicator
addresses
- The address(es) to connect to.
public void disconnect(java.lang.String[] adresses)
disconnect
in interface Communicator
adresses
- Not used.public void sendMessage(java.lang.Object message, boolean confirm)
sendMessage
in interface Communicator
message
- The message to send.confirm
- Not used in this implementation.public void notifyAboutMessageReceived(java.lang.Object message)
notifyAboutMessageReceived
in interface Communicator
message
- The message that was received.AbstractGame.notifyAboutMessageReceived(String)
public void close()
close
in interface Communicator
public void searchForNodes()
searchForNodes
in interface Communicator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |