sendMsg function
Send a message with the given message ID and message payload. Returns a boolean that specifies if the command was successful.
Implementation
bool sendMsg(int msgID, String payload) {
// Ensures that the RCON socket exists.
if (rconSck == null) {
return false;
}
// Message length is the payload length + 10 to account
// for the headers and suffix.
int msgLen = 10 + payload.length;
// Creates the full RCON message.
Uint8List fullMsg = cM(msgLen, msgID, payload);
// Add the RCON message to the socket stream.
rconSck!.add(fullMsg);
print("mc_rcon: sent payload ($fullMsg) on socket");
return true;
}