public function read($length, $type = PHP_BINARY_READ)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use ($length, $type) {
                return @socket_read($resource, $length, $type);
            }
        );
    }