public class Protocol extends Object
| Constructor and Description |
|---|
Protocol(Socket ctlSocketParam)
Constructor that accepts socket over which to communicate as parameter
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method to close open Streams
|
int |
readn(Message msgParam,
int iParamAmount)
Populate Message byte array with specific number of bytes of data from
socket input stream
|
int |
recv_msg(Message msgParam)
Receive message at end-point of socket
|
void |
send_json_login_msg(byte bParamType,
byte[] bParamToSend)
Send protocol messages given their type and data byte array
|
void |
send_json_msg(byte bParamType,
byte bParamToSend)
Send message given its Type and data byte
|
void |
send_json_msg(byte bParamType,
byte[] bParamToSend)
Send protocol messages given their type and data byte array
|
void |
send_msg(byte bParamType,
byte bParamToSend)
Send message given its Type and data byte
|
void |
send_msg(byte bParamType,
byte[] bParamToSend)
Send protocol messages given their type and data byte array
|
void |
setJsonSupport(boolean jsonSupport) |
public Protocol(Socket ctlSocketParam) throws IOException
ctlSocketParam - socket used to send the protocol messages overIOException - if Input/Output streams cannot be read from/written into correctlypublic void close()
public int readn(Message msgParam, int iParamAmount) throws IOException
msgParam - Message object to be populatediParamAmount - specified number of bytes to be readIOException - If data cannot be successfully read from the Input Streampublic int recv_msg(Message msgParam) throws IOException
msgParam - Message objecta) Success:
b) Error:
IOExceptionpublic void send_json_login_msg(byte bParamType,
byte[] bParamToSend)
throws IOException
bParamType - Control Message TypebParamToSend - Data value array to sendIOException - If data cannot be successfully written to the Output Streampublic void send_json_msg(byte bParamType,
byte bParamToSend)
throws IOException
bParamType - Control Message TypebParamToSend - Data value to sendIOException - If data cannot be successfully written to the Output Streampublic void send_json_msg(byte bParamType,
byte[] bParamToSend)
throws IOException
bParamType - Control Message TypebParamToSend - Data value array to sendIOException - If data cannot be successfully written to the Output Streampublic void send_msg(byte bParamType,
byte bParamToSend)
throws IOException
bParamType - Control Message TypebParamToSend - Data value to sendIOException - If data cannot be successfully written to the Output Streampublic void send_msg(byte bParamType,
byte[] bParamToSend)
throws IOException
bParamType - Control Message TypebParamToSend - Data value array to sendIOException - If data cannot be successfully written to the Output Streampublic void setJsonSupport(boolean jsonSupport)