public class ClientProcess extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ClientProcess.Protocol
Implement this to define the behavior of the communication on the client side.
|
| Constructor and Description |
|---|
ClientProcess(ClientProcess.Protocol protocol) |
| Modifier and Type | Method and Description |
|---|---|
MessageObject |
readMessage()
Call this to listen for a message from the server.
|
boolean |
sendMessage(String messageType,
String message) |
boolean |
sendMessage(String messageType,
String message,
Serializable data)
Call this to send a message with some binary data.
|
MessageObject |
sendMessageWaitForReply(String messageType,
String message,
Serializable data)
Call this to send a message with some binary data and wait for the server's acknowledgement.
|
boolean |
start(int port)
Call this to attempt to connect to the server.
|
void |
stop()
Call this to stop communications with the server.
|
public ClientProcess(ClientProcess.Protocol protocol)
public boolean start(int port)
port - where the server is listening. Since it launched this client, it should have either been passed to it on the command line or via a system property (-D).public void stop()
public boolean sendMessage(String messageType, String message, Serializable data)
messageType - the message type. Whatever the client and server want.message - the message being sentdata - the data being sent. Must be serializable.public MessageObject sendMessageWaitForReply(String messageType, String message, Serializable data)
messageType - the message type. Whatever the client and server want.message - the message being sentdata - the data being sent. Must be serializable.public MessageObject readMessage()
Copyright © 2013. All rights reserved