private function readBytes($bytes, $noBuffer)
    {
        if(!$this->socket) {
            return "";
        }

        if($noBuffer) {
            return fread($this->socket, $bytes);
        }

        $bytes_left = $bytes;
        $retval = "";
        while( !feof($this->socket) && $bytes_left > 0 ) {
            $res = fread($this->socket, $bytes_left);
            $retval.=$res;
            $bytes_left-=strlen($res);
        }

        return $retval;
    }
private function readBytes($bytes, $noBuffer)
    {
        if(!$this->socket) {
            return "";
        }

        if($noBuffer) {
            return fread($this->socket, $bytes);
        }

        $bytes_left = $bytes;
        $retval = "";
        while( !feof($this->socket) && $bytes_left > 0 ) {
            $res = fread($this->socket, $bytes_left);
            $retval.=$res;
            $bytes_left-=strlen($res);
        }

        return $retval;
    }
private function readBytes ( $ bytes , $ noBuffer ) { if ( ! $ this -> socket ) { return "" ; } if ( $ noBuffer ) { return fread ( $ this -> socket , $ bytes ) ; } $ bytes_left = $ bytes ; $ retval = "" ; while ( ! feof ( $ this -> socket ) && $ bytes_left > 0 ) { $ res = fread ( $ this -> socket , $ bytes_left ) ; $ retval .= $ res ; $ bytes_left -= strlen ( $ res ) ; } return $ retval ; }
Read x bytes from socket

@param int $bytes Number of bytes to read
@param boolean $noBuffer If true, use only direct fread
Read x bytes from socket