當前位置: 首頁>>代碼示例>>Python>>正文


Python zmq.RCVMORE屬性代碼示例

本文整理匯總了Python中zmq.RCVMORE屬性的典型用法代碼示例。如果您正苦於以下問題:Python zmq.RCVMORE屬性的具體用法?Python zmq.RCVMORE怎麽用?Python zmq.RCVMORE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在zmq的用法示例。


在下文中一共展示了zmq.RCVMORE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: feedback_loop

# 需要導入模塊: import zmq [as 別名]
# 或者: from zmq import RCVMORE [as 別名]
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) 
開發者ID:darkwallet,項目名稱:gateway,代碼行數:18,代碼來源:broadcast.py

示例2: recv_multipart

# 需要導入模塊: import zmq [as 別名]
# 或者: from zmq import RCVMORE [as 別名]
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 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:35,代碼來源:socket.py

示例3: recv_multipart

# 需要導入模塊: import zmq [as 別名]
# 或者: from zmq import RCVMORE [as 別名]
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 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:34,代碼來源:socket.py

示例4: feedback_loop

# 需要導入模塊: import zmq [as 別名]
# 或者: from zmq import RCVMORE [as 別名]
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) 
開發者ID:darkwallet,項目名稱:gateway,代碼行數:17,代碼來源:radar.py


注:本文中的zmq.RCVMORE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。