/** * Receives a number of bytes from the server. * * @param integer $length Number of bytes to read. * * @return string The server response. */ protected function _recvBytes($length) { $response = ''; $response_length = 0; while ($response_length < $length) { $response .= $this->_sock->read($length - $response_length); $response_length = strlen($response); } $this->_debug('S: ' . rtrim($response)); return $response; }