mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Fix RCON packet structure
This commit is contained in:
parent
6b9fdc0ffe
commit
4a0bb736c6
1 changed files with 6 additions and 2 deletions
|
|
@ -104,7 +104,11 @@ class RCONInstance extends Thread{
|
|||
}
|
||||
|
||||
private function writePacket($client, $requestID, $packetType, $payload){
|
||||
return socket_write($client, Utils::writeLInt(strlen($payload)).Utils::writeLInt((int) $requestID).Utils::writeLInt((int) $packetType).($payload === "" ? "\x00":$payload)."\x00");
|
||||
$pk = Utils::writeLInt((int) $requestID)
|
||||
. Utils::writeLInt((int) $packetType)
|
||||
. $payload
|
||||
. "\x00\x00"; //Terminate payload and packet
|
||||
return socket_write($client, Utils::writeLInt(strlen($pk)).$pk);
|
||||
}
|
||||
|
||||
private function readPacket($client, &$size, &$requestID, &$packetType, &$payload){
|
||||
|
|
@ -223,4 +227,4 @@ class RCONInstance extends Thread{
|
|||
unset($this->socket, $this->cmd, $this->response, $this->stop);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue