public function read($length, $type = PHP_BINARY_READ)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use ($length, $type) {
                return @socket_read($resource, $length, $type);
            }
        );
    }
public function read($length, $type = PHP_BINARY_READ)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use ($length, $type) {
                return @socket_read($resource, $length, $type);
            }
        );
    }
public function read ( $ length , $ type = PHP_BINARY_READ ) { return static :: exceptionOnFalse ( $ this -> resource , function ( $ resource ) use ( $ length , $ type ) { return @ socket_read ( $ resource , $ length , $ type ) ; } ) ; }
reads a maximum of length bytes from a socket.

<p>Reads from the socket created by the <code>create()</code> or <code>accept()</code> functions.</p>

@param int $length <p>The maximum number of bytes read is specified by the length parameter. Otherwise you can
use <code>\r</code>, <code>\n</code>, or <code>\0</code> to end reading (depending on the type parameter, see
below).</p>
@param int $type   <p>(Optional) type parameter is a named constant:<ul><li><code>PHP_BINARY_READ</code> (Default)
- use the system <code>recv()</code> function. Safe for reading binary data.</li><li>
<code>PHP_NORMAL_READ</code> - reading stops at <code>\n</code> or <code>\r</code>.</li></ul></p>

@throws Exception\SocketException If there was an error reading or if the host closed the connection.

@see Socket::create()
@see Socket::accept()

@return string Returns the data as a string. Returns a zero length string ("") when there is no more data to
read.
reads a maximum of length bytes from a socket .