public function readBinary(int $length = 1024): string
    {
        $data = fread($this->resource, $length);
        if (false === $data) {
            if (stream_get_meta_data($this->resource)['timed_out']) {
                throw new Timeout(
                        'Reading of ' . $length . ' bytes failed: timeout of '
                        . $this->timeout . ' seconds exceeded'
                );
            }

            throw new ConnectionFailure(
                    'Reading of ' . $length . ' bytes failed.'
            );
        }

        return $data;
    }
public function readBinary(int $length = 1024): string
    {
        $data = fread($this->resource, $length);
        if (false === $data) {
            if (stream_get_meta_data($this->resource)['timed_out']) {
                throw new Timeout(
                        'Reading of ' . $length . ' bytes failed: timeout of '
                        . $this->timeout . ' seconds exceeded'
                );
            }

            throw new ConnectionFailure(
                    'Reading of ' . $length . ' bytes failed.'
            );
        }

        return $data;
    }
public function readBinary ( int $ length = 1024 ) : string { $ data = fread ( $ this -> resource , $ length ) ; if ( false === $ data ) { if ( stream_get_meta_data ( $ this -> resource ) [ 'timed_out' ] ) { throw new Timeout ( 'Reading of ' . $ length . ' bytes failed: timeout of ' . $ this -> timeout . ' seconds exceeded' ) ; } throw new ConnectionFailure ( 'Reading of ' . $ length . ' bytes failed.' ) ; } return $ data ; }
read binary data from socket

@param   int  $length  length of data to read
@return  string  data read from socket
@throws  \stubbles\peer\ConnectionFailure
@throws  \stubbles\peer\Timeout
read binary data from socket