'Read from the socket and call our on_data_available with the data.'

def _handle_read(self):

    try:
        while True:
            try:
                if self.params.ssl:
                    data = self.socket.read(self._buffer_size)
                else:
                    data = self.socket.recv(self._buffer_size)
                break
            except _SOCKET_ERROR as error:
                if (error.errno == errno.EINTR):
                    continue
                else:
                    raise
    except socket.timeout:
        self._handle_timeout()
        return 0
    except ssl.SSLError as error:
        if (error.args[0] == ssl.SSL_ERROR_WANT_READ):
            return 0
        return self._handle_error(error)
    except _SOCKET_ERROR as error:
        if (error.errno in (errno.EAGAIN, errno.EWOULDBLOCK)):
            return 0
        return self._handle_error(error)
    if ((not data) or (data == 0)):
        LOGGER.error('Read    empty    data,    calling    disconnect')
        return self._on_terminate(connection.InternalCloseReasons.SOCKET_ERROR, 'EOF')
    self._on_data_available(data)
    return len(data)
