protected function readAll($socket) { $all = ''; while (!$this->isLastPacket($next = $socket->read())) { $all .= $next; } return $all; }