mqtt TimeoutError:(WinError 10060)但当我更改发布者pc和Subricer pc时,它会工作

2024-09-30 18:20:13 发布

您现在位置:Python中文网/ 问答频道 /正文

while True:
    aft = datetime.datetime.now()
    mongoQry = {"time": aft.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3], "Housing Input BWD Sensor": "NULL",
        "Inverter Run": "NULL",
        "Pressure Sensor": "NULL", "NGQuantity": "NULL", "RedQuantity": "NULL",
        "SilverQuantity": "NULL",
        "Alarm-Insert Disassembly Down Sensor": "NULL", "Alarm-Insert Input Up Sensor": "NULL",
        "Alarm-Housing Input Forward Sensor": "NULL", "Alarm-Housing Input Backward Sensor": "NULL"}
    strmongoQry = json.dumps(mongoQry)


    # bimongoQry = dict_to_binary(mongoQry)
    publish.single("paho/test/single",strmongoQry , hostname="192.168.0.12")
    print("Mongo success")
    sleep(1)

这是我非常简单的代码 但是pc机(192.168.0.12)无法接收到该信息 当我使用pc(192.168.0.12)将MQTT消息发送到之前发布的计算机时, 它起作用了

我还关闭了pc上的防火墙(192.168.0.12)

谁会让我知道出了什么事


Tags: trueinputdatetimesensornullnowinsertpc