【求助】python写的mqtt client,连接apollo总是报错 Error 10054
首先,apollo正常启动
python代码,很简单:
import time
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected with result code " + str(rc))
if __name__ == "__main__":
client = mqtt.Client()
client.username_pw_set(username="admins",password="password")
client.on_connect = on_connect
client.connect("127.0.0.1", 61613, 60)
client.loop_start()
#while True:
time.sleep(1)
client.publish(topic="message", payload="hello")
python2.7编译器,运行后报错
Connected to pydev debugger (build 173.4674.37)
[Errno 10054]
Exception in thread Thread-6 (most likely raised during interpreter shutdown):
Process finished with exit code 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
python代码需要增加一行