(self, timeout=None)
return None
Blocks, until a message (response or event) has been received.

        If an event is received it is appended to the :attr:`_event_queue` and
        returned.

        If a query response is received, it is only returned (but not cachd).

        :arg float timeout:
            The maximum time in seconds waited for a response a event.
        :type timeout:
            None or float

        :rtype: TS3Event or TS3QueryResponse
        :returns:
            A TS3Event or TS3QueryResponse

        :raises TS3TimeoutError:
        :raises TS3RecvError:
Blocks, until a message (response or event) has been received.
Blocks until a message ( response or event ) has been received .
def _recv(self, timeout=None):
        """
        Blocks, until a message (response or event) has been received.

        If an event is received it is appended to the :attr:`_event_queue` and
        returned.

        If a query response is received, it is only returned (but not cachd).

        :arg float timeout:
            The maximum time in seconds waited for a response a event.
        :type timeout:
            None or float

        :rtype: TS3Event or TS3QueryResponse
        :returns:
            A TS3Event or TS3QueryResponse

        :raises TS3TimeoutError:
        :raises TS3RecvError:
        """
        end_time = timeout + time.time() if timeout is not None else None

        while True:
            timeout = end_time - time.time() if end_time is not None else None

            try:
                data = self._telnet_conn.read_until(b"\n\r", timeout=timeout)
            # Catch socket and telnet errors
            except (OSError, EOFError) as err:
                self.close()
                raise
            # Handle the receives message.
            else:
                if not data:
                    raise TS3TimeoutError()
                elif data.startswith(b"notify"):
                    event = TS3Event(data)
                    self._event_queue.append(event)
                    return event

                elif data.startswith(b"error"):
                    self._telnet_queue.append(data)
                    data = b"".join(self._telnet_queue)
                    self._telnet_queue = list()

                    resp = TS3QueryResponse(data)
                    self._num_pending_queries -= 1
                    return resp
                else:
                    self._telnet_queue.append(data)
        return None
def _recv ( self , timeout = None ) : end_time = timeout + time . time ( ) if timeout is not None else None while True : timeout = end_time - time . time ( ) if end_time is not None else None try : data = self . _telnet_conn . read_until ( b"\n\r" , timeout = timeout ) # Catch socket and telnet errors except ( OSError , EOFError ) as err : self . close ( ) raise # Handle the receives message. else : if not data : raise TS3TimeoutError ( ) elif data . startswith ( b"notify" ) : event = TS3Event ( data ) self . _event_queue . append ( event ) return event elif data . startswith ( b"error" ) : self . _telnet_queue . append ( data ) data = b"" . join ( self . _telnet_queue ) self . _telnet_queue = list ( ) resp = TS3QueryResponse ( data ) self . _num_pending_queries -= 1 return resp else : self . _telnet_queue . append ( data ) return None