public class ByondClient extends Object
Socket
.
BYOND game servers didn't developed to handle external communication due sockets,
so while reading response data, there is no way to know where it's ended.
The only way to close socket connection is during SocketTimeoutException
.
sendMessage(ByondMessage, int)
method.Constructor and Description |
---|
ByondClient() |
Modifier and Type | Method and Description |
---|---|
static ByondClient |
create()
Static method to do things instead of this:
ByondClient client = new ByondClient();
client.sendCommand(
like that:
ByondClient.create().sendCommand(
|
void |
sendCommand(ByondMessage byondMessage)
Send message to BYOND game server without waiting for response.
|
ByondResponse |
sendMessage(ByondMessage byondMessage)
Send message to BYOND game server with getting response.
|
ByondResponse |
sendMessage(ByondMessage byondMessage,
int readTimeout)
Send message to BYOND game server with getting response.
|
public static ByondClient create()
ByondClient client = new ByondClient();
client.sendCommand(ByondMessage
);
like that:
ByondClient.create().sendCommand(ByondMessage
);
ByondClient
instance.public void sendCommand(ByondMessage byondMessage) throws HostUnavailableException
byondMessage
- message to send.HostUnavailableException
- signals that requested server unavailable to connect. Offline or some other reason.public ByondResponse sendMessage(ByondMessage byondMessage) throws HostUnavailableException, UnexpectedResponseTypeException, EmptyResponseException
sendMessage(ByondMessage, int)
but second argument, which is read timeout time,
taken by default as 500 ms.byondMessage
- mesasge to send.ByondResponse
or as null, if message response type was ResponseType.NONE
.HostUnavailableException
- signals that requested server unavailable to connect. Offline or some other reason.UnexpectedResponseTypeException
- thrown if expected response doesn't equals to actual.EmptyResponseException
- thrown if response was empty, but user wait for something. Reason could hide
in BYOND game server itself. Typical, it doesn't handle message which was send and, as a result, not provide any response.public ByondResponse sendMessage(ByondMessage byondMessage, int readTimeout) throws HostUnavailableException, UnexpectedResponseTypeException, EmptyResponseException
byondMessage
- message to send.readTimeout
- timeout time to read response.ByondResponse
or as null, if message response type was ResponseType.NONE
.HostUnavailableException
- signals that requested server unavailable to connect. Offline or some other reason.UnexpectedResponseTypeException
- thrown if expected response doesn't equals to actual.EmptyResponseException
- thrown if response was empty, but user wait for something. Reason could hide
in BYOND game server itself. Typical, it doesn't handle message which was send and, as result, not provide any response.Copyright © 2017. All rights reserved.