class_docstr: Parser class for connections using Hiredis
class_docstr_tok: ["Parser","class","for","connections","using","Hiredis"]
code: def read_from_socket(self, timeout=SENTINEL, raise_on_timeout=True):
      sock = self._sock
      custom_timeout = timeout is not SENTINEL
      try:
          if custom_timeout:
              sock.settimeout(timeout)
          bufflen = self._sock.recv_into(self._buffer)
          if bufflen == 0:
              raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
          self._reader.feed(self._buffer, 0, bufflen)
          # data was read from the socket and added to the buffer.
          # return True to indicate that data was read.
          return True
      except socket.timeout:
          if raise_on_timeout:
              raise TimeoutError("Timeout reading from socket")
          return False
      except NONBLOCKING_EXCEPTIONS as ex:
          # if we're in nonblocking mode and the recv raises a
          # blocking error, simply return False indicating that
          # there's no data to be read. otherwise raise the
          # original exception.
          allowed = NONBLOCKING_EXCEPTION_ERROR_NUMBERS.get(
              ex.__class__, -1
          )
          if not raise_on_timeout and ex.errno == allowed:
              return False
          raise ConnectionError(
              f"Error while reading from socket: {ex.args}"
          )
      finally:
          if custom_timeout:
              sock.settimeout(self._socket_timeout)
  
imports: import asyncio
  import socket
  import sys
  from typing import Callable, List, Optional, Union
  from redis.compat import TypedDict
  from ..exceptions import ConnectionError, InvalidResponse, RedisError
  from ..typing import EncodableT
  from ..utils import HIREDIS_AVAILABLE
  from .base import AsyncBaseParser, BaseParser
  from .socket import NONBLOCKING_EXCEPTION_ERROR_NUMBERS, NONBLOCKING_EXCEPTIONS, SENTINEL, SERVER_CLOSED_CONNECTION_ERROR
label_desc: Use image node_id 6 for calling the _HiredisParser obj's underlying member method code with example usage: obj.read_from_socket(timeout, raise_on_timeout) and returns: True, False, False