lib/SteamCondenser/Servers/Sockets/RCONSocket.php
public function getReply() {
        try {
            if ($this->receivePacket(4) == 0) {
                $this->socket->close();
                return null;
            }
        } catch (ConnectionResetException $e) {
            $this->socket->close();
            return null;
        }

        $packetSize     = $this->buffer->getLong();
        $remainingBytes = $packetSize;

        $packetData = '';
        do {
            $receivedBytes = $this->receivePacket($remainingBytes);
            $remainingBytes -= $receivedBytes;
            $packetData .= $this->buffer->get();
        } while($remainingBytes > 0);

        $packet = RCONPacketFactory::getPacketFromData($packetData);

        $this->logger->debug('Received packet of type ' . get_class($packet));

        return $packet;
    }
public function getReply() {
        try {
            if ($this->receivePacket(4) == 0) {
                $this->socket->close();
                return null;
            }
        } catch (ConnectionResetException $e) {
            $this->socket->close();
            return null;
        }

        $packetSize     = $this->buffer->getLong();
        $remainingBytes = $packetSize;

        $packetData = '';
        do {
            $receivedBytes = $this->receivePacket($remainingBytes);
            $remainingBytes -= $receivedBytes;
            $packetData .= $this->buffer->get();
        } while($remainingBytes > 0);

        $packet = RCONPacketFactory::getPacketFromData($packetData);

        $this->logger->debug('Received packet of type ' . get_class($packet));

        return $packet;
    }
Reads a packet from the socket

The Source RCON protocol allows packets of an arbitrary sice transmitted
using multiple TCP packets. The data is received in chunks and
concatenated into a single response packet.

@return SteamPacket The packet replied from the server or
<var>null</var> if the connection has been closed by the server