src/mg/Ding/Helpers/Tcp/TcpClientHelper.php
public function read(&$buffer, $length, $peek = false)
    {
        $length = socket_recv($this->_socket, $buffer, $length, $peek ? MSG_PEEK : 0);
        return $length;
    }
public function read(&$buffer, $length, $peek = false)
    {
        $length = socket_recv($this->_socket, $buffer, $length, $peek ? MSG_PEEK : 0);
        return $length;
    }
Call this to read data from the server. Returns the number of bytes read.

@param string  $buffer Where to store the read data.
@param integer $length Maximum length of data to read.
@param boolean $peek   If true, will not remove the data from the socket.

@return integer