def send(self, data, timeout=30): """ Try to send the message until it either sends or hits timeout. :param timeout: Timeout to retry sending the message :type timeout: ``int`` """ return retry_until_timeout(exception=zmq.ZMQError, item=self._socket.send, kwargs={ 'data': data, 'flags': zmq.NOBLOCK }, timeout=timeout, raise_on_timeout=True)
def receive(self, timeout=30): """ Try to receive the message until it has either been received or hits timeout. :param timeout: Timeout to retry receiving the message. :type timeout: ``int`` :return: The received message. :rtype: ``bytes`` or ``zmq.sugar.frame.Frame`` or ``memoryview`` """ return retry_until_timeout(exception=zmq.ZMQError, item=self._socket.recv, kwargs={'flags': zmq.NOBLOCK}, timeout=timeout, raise_on_timeout=True)
def send(self, data, timeout=30): """ Try to send the message until it either sends or hits timeout. :param data: The content of the message. :type data: ``bytes`` or ``zmq.sugar.frame.Frame`` or ``memoryview`` :param timeout: Timeout to retry sending the message. :type timeout: ``int`` :return: ``None`` :rtype: ``NoneType`` """ return retry_until_timeout(exception=zmq.ZMQError, item=self._socket.send, kwargs={'data': data, 'flags': zmq.NOBLOCK}, timeout=timeout, raise_on_timeout=True)
def receive(self, timeout=30): """ Try to send the message until it either has been received or hits timeout. :param timeout: Timeout to retry receiving the message :type timeout: ``int`` :return: The received message :rtype: ``object`` or ``str`` or ``zmq.sugar.frame.Frame`` """ return retry_until_timeout( exception=zmq.ZMQError, item=self._socket.recv, kwargs={"flags": zmq.NOBLOCK}, timeout=timeout, raise_on_timeout=True, )