public function receive(&$buffer, $length, $flags)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use (&$buffer, $length, $flags) {
                return @socket_recv($resource, $buffer, $length, $flags);
            }
        );
    }
public function receive(&$buffer, $length, $flags)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use (&$buffer, $length, $flags) {
                return @socket_recv($resource, $buffer, $length, $flags);
            }
        );
    }
public function receive ( & $ buffer , $ length , $ flags ) { return static :: exceptionOnFalse ( $ this -> resource , function ( $ resource ) use ( & $ buffer , $ length , $ flags ) { return @ socket_recv ( $ resource , $ buffer , $ length , $ flags ) ; } ) ; }
Receives data from a connected socket.

<p>Receives length bytes of data in buffer from the socket. <code>receive()</code> can be used to gather data
from connected sockets. Additionally, one or more flags can be specified to modify the behaviour of the
function.</p><p>buffer is passed by reference, so it must be specified as a variable in the argument list. Data
read from socket by <code>receive()</code> will be returned in buffer.</p>

@param string $buffer <p>The data received will be fetched to the variable specified with buffer. If an error
occurs, if the connection is reset, or if no data is available, buffer will be set to <code>NULL</code>.</p>
@param int    $length Up to length bytes will be fetched from remote host.
@param int    $flags  <p>The value of flags can be any combination of the following flags, joined with the binary OR
(<code>|</code>) operator.<ul><li><code>MSG_OOB</code> - Process out-of-band data.</li><li><code>MSG_PEEK</code>
- Receive data from the beginning of the receive queue without removing it from the queue.</li><li>
<code>MSG_WAITALL</code> - Block until at least length are received. However, if a signal is caught or the
remote host disconnects, the function may return less data.</li><li><code>MSG_DONTWAIT</code> - With this flag
set, the function returns even if it would normally have blocked.</li></ul></p>

@throws Exception\SocketException If there was an error receiving data.

@return int Returns the number of bytes received.
Receives data from a connected socket .