mc_rcon_dart library

Properties

rconSck Socket?
The socket that is used to communicate with the RCON server. Generated when createSocket() is run.
getter/setter pair
requestID int
The randomly generated request ID that is sent with every message to the RCON server. Used to ensure that the commands sent to and received from the server are ours, and not another user's.
getter/setter pair

Functions

close() bool
Closes the socket to the RCON server. Returns a bool that specified whether the socket was successfully destroyed.
cM(int msgLen, int msgID, String payload) Uint8List
Returns the whole RCON message as a Uint8List. Requires the message length, message ID, and the payload.
createMessage(int msgLen, int msgID, String payload, [int? overrideReqID]) Uint8List
Returns the whole RCON message as a Uint8List. Requires the message length, message ID, and the payload.
createSocket(String host, {int port = 25575}) Future<void>
Creates and stores a socket connected to the RCON server with the given host (IP/FQDN) and port. Port defaults to 25575 if no port is specified.
listen(Function onData) bool
Starts listening on the socket for packets sent by the RCON server. Returns a boolean that specifies if the socket has started listening. Note: onData must accept a List
login(String password) bool
Log in to the RCON server using the given socket and password. Returns a boolean that specifies if the command was successful.
processServerResponse(Uint8List data, Function onData) → void
Processes the server response (represented as a Uint8List) and calls onData handler if we have received a good packet.
processToInt32(Uint8List data, int start) int
Returns a little Endian int32 interpreted from 4 Uint8s retrieved from data (Uint8List) starting at an index of start (int). The Uint8list length must be at least 4 and start must be data.length - 4 or smaller. Returns -1 if processing has failed.
pSR(Uint8List data, Function onData) → void
Processes the server response (represented as a Uint8List) and calls onData handler if we have received a good packet.
sendCommand(String command) bool
Send the provided command to the RCON server using the Returns a boolean that specifies if the command was successful.
sendMsg(int msgID, String payload) bool
Send a message with the given message ID and message payload. Returns a boolean that specifies if the command was successful.
u8LCopy4(Uint8List original, {int start = 0}) Uint8List
Returns a Uint8Lit that contains only 4 integers starting from originalstart. Start defaults to 0 if not set. If 4 integers cannot be copied from the list (e.g. list length is less than 4 or start is too large to copy 4 integers), a list of -1, -1, -1, -1 will be returned. Returns 0 in place of any integer if that location is empty in the source list.