/** * This handles a fragmented response. * (https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Multiple-packet_Responses) * * We basically send a RESPONSE_VALUE Message to the server to force the response of the rest of the package, * until we receive another package or an empty response. * * All the received data is then appended to the current ResponseMessage. * * @param $responseMessage * @throws Exception\InvalidPacketException */ protected function handleFragmentedResponse(Message $responseMessage) { do { usleep(20000); // some servers stop responding if we send to many packages so we wait 20ms $this->client->write(Message::TYPE_RESPONSE_VALUE); $responseData = $this->client->read(4096); if (empty($responseData)) { break; } $fragmentedMessage = new Message(); $fragmentedMessage->initializeFromRconData($responseData, true); $responseMessage->append($fragmentedMessage); if ($fragmentedMessage->getType() !== Message::TYPE_RESPONSE_VALUE) { break; } } while (true); }