mqsub.py 文件源码

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

项目:python_banyan 作者: MrYsLab 项目源码 文件源码
def __init__(self):
        """
        Start the client, subscribe to "test" and start the loop
        """
        super(MQSUB, self).__init__()
        # super().on_connect = self.on_connect
        # super().on_message = self.on_message

        self.start = 0
        self.end = 0
        self.message_count = 0

        # determine current IP address of the local computer
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        # use the google dns
        s.connect(('8.8.8.8', 0))
        self.ip_address = s.getsockname()[0]

        self.connect(self.ip_address, 1883, 60)
        self.subscribe("test", 0)

        self.loop_forever()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号