Python zmq.RCVMORE Examples
The following are 6
code examples of zmq.RCVMORE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
zmq
, or try the search function
.
Example #1
Source File: broadcast.py From gateway with GNU Affero General Public License v3.0 | 6 votes |
def feedback_loop(self, *args): # feedback socket ctx = zmq.Context() socket = ctx.socket(zmq.SUB) socket.setsockopt(zmq.SUBSCRIBE, "") socket.connect(config.get("broadcaster-feedback-url", "tcp://localhost:9110")) print "brc feedback channel connected" while True: msg = [socket.recv()] while socket.getsockopt(zmq.RCVMORE): msg.append(socket.recv()) print "feedback msg" if len(msg) == 3: self.on_feedback_msg(*msg) else: print "bad feedback message", len(msg)
Example #2
Source File: socket.py From vnpy_crypto with MIT License | 5 votes |
def recv_multipart(self, flags=0, copy=True, track=False): """Receive a multipart message as a list of bytes or Frame objects Parameters ---------- flags : int, optional Any valid flags for :func:`Socket.recv`. copy : bool, optional Should the message frame(s) be received in a copying or non-copying manner? If False a Frame object is returned for each part, if True a copy of the bytes is made for each frame. track : bool, optional Should the message frame(s) be tracked for notification that ZMQ has finished with it? (ignored if copy=True) Returns ------- msg_parts : list A list of frames in the multipart message; either Frames or bytes, depending on `copy`. Raises ------ ZMQError for any of the reasons :func:`~Socket.recv` might fail """ parts = [self.recv(flags, copy=copy, track=track)] # have first part already, only loop while more to receive while self.getsockopt(zmq.RCVMORE): part = self.recv(flags, copy=copy, track=track) parts.append(part) return parts
Example #3
Source File: socket.py From Computable with MIT License | 5 votes |
def recv_multipart(self, flags=0, copy=True, track=False): """receive a multipart message as a list of bytes or Frame objects Parameters ---------- flags : int, optional Any supported flag: NOBLOCK. If NOBLOCK is set, this method will raise a ZMQError with EAGAIN if a message is not ready. If NOBLOCK is not set, then this method will block until a message arrives. copy : bool, optional Should the message frame(s) be received in a copying or non-copying manner? If False a Frame object is returned for each part, if True a copy of the bytes is made for each frame. track : bool, optional Should the message frame(s) be tracked for notification that ZMQ has finished with it? (ignored if copy=True) Returns ------- msg_parts : list A list of frames in the multipart message; either Frames or bytes, depending on `copy`. """ parts = [self.recv(flags, copy=copy, track=track)] # have first part already, only loop while more to receive while self.getsockopt(zmq.RCVMORE): part = self.recv(flags, copy=copy, track=track) parts.append(part) return parts
Example #4
Source File: socket.py From pySINDy with MIT License | 5 votes |
def recv_multipart(self, flags=0, copy=True, track=False): """Receive a multipart message as a list of bytes or Frame objects Parameters ---------- flags : int, optional Any valid flags for :func:`Socket.recv`. copy : bool, optional Should the message frame(s) be received in a copying or non-copying manner? If False a Frame object is returned for each part, if True a copy of the bytes is made for each frame. track : bool, optional Should the message frame(s) be tracked for notification that ZMQ has finished with it? (ignored if copy=True) Returns ------- msg_parts : list A list of frames in the multipart message; either Frames or bytes, depending on `copy`. Raises ------ ZMQError for any of the reasons :func:`~Socket.recv` might fail """ parts = [self.recv(flags, copy=copy, track=track)] # have first part already, only loop while more to receive while self.getsockopt(zmq.RCVMORE): part = self.recv(flags, copy=copy, track=track) parts.append(part) return parts
Example #5
Source File: radar.py From gateway with GNU Affero General Public License v3.0 | 5 votes |
def feedback_loop(self, *args): # feedback socket ctx = zmq.Context() socket = ctx.socket(zmq.SUB) socket.setsockopt(zmq.SUBSCRIBE, "") socket.connect(config.get("radar-feedback-url", "tcp://localhost:7678")) print "radar feedback channel connected" while True: msg = [socket.recv()] while socket.getsockopt(zmq.RCVMORE): msg.append(socket.recv()) if len(msg) == 2: self.on_feedback_msg(*msg) else: print "bad feedback message", len(msg)
Example #6
Source File: socket.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
def recv_multipart(self, flags=0, copy=True, track=False): """Receive a multipart message as a list of bytes or Frame objects Parameters ---------- flags : int, optional Any valid flags for :func:`Socket.recv`. copy : bool, optional Should the message frame(s) be received in a copying or non-copying manner? If False a Frame object is returned for each part, if True a copy of the bytes is made for each frame. track : bool, optional Should the message frame(s) be tracked for notification that ZMQ has finished with it? (ignored if copy=True) Returns ------- msg_parts : list A list of frames in the multipart message; either Frames or bytes, depending on `copy`. Raises ------ ZMQError for any of the reasons :func:`~Socket.recv` might fail """ parts = [self.recv(flags, copy=copy, track=track)] # have first part already, only loop while more to receive while self.getsockopt(zmq.RCVMORE): part = self.recv(flags, copy=copy, track=track) parts.append(part) return parts