zmq_tools.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:esys-pbi 作者: fsxfreak 项目源码 文件源码
def recv(self):
        '''Recv a message with topic, payload.

        Topic is a utf-8 encoded string. Returned as unicode object.
        Payload is a msgpack serialized dict. Returned as a python dict.

        Any addional message frames will be added as a list
        in the payload dict with key: '__raw_data__' .
        '''
        topic = self.socket.recv_string()
        payload = serializer.loads(self.socket.recv(), encoding='utf-8')
        extra_frames = []
        while self.socket.get(zmq.RCVMORE):
            extra_frames.append(self.socket.recv())
        if extra_frames:
            payload['__raw_data__'] = extra_frames
        return topic, payload
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号