在Python2.7中发送数据时,Azure IoT中心发布者TIMEOUT

时间:2016-08-30 12:47:14

标签: python azure iot

我正在尝试从运行Raspbian OS的BananaPi M3向Azure IoT中心(AIH)服务器发送一些数据。为此,我为AIH构建了Python 2.7库,并获得了名为iothub_client.so的有效库。为了测试lib是否正常,我只是尝试进行一个简单的导入,例如:from iothub_client import *并且它有效。
因此,在此之后,我按照Math.max所述设置连接字符串,并从here运行脚本。
这是应用程序的输出:

> >>> ================================ RESTART ================================
>>> 

Python 2.7.9 (default, Mar  8 2015, 00:52:26) 
[GCC 4.9.2]
IoT Hub for Python SDK Version: 1.0.13
Starting the IoT Hub Python sample...
    Protocol MQTT
    Connection string=HostName=************************;DeviceId=*************;SharedAccessKey=*************************
IoTHubClient sending 5 messages
IoTHubClient.send_event_async accepted message [0] for transmission to IoT Hub.
IoTHubClient.send_event_async accepted message [1] for transmission to IoT Hub.
IoTHubClient.send_event_async accepted message [2] for transmission to IoT Hub.
IoTHubClient.send_event_async accepted message [3] for transmission to IoT Hub.
IoTHubClient.send_event_async accepted message [4] for transmission to IoT Hub.
Confirmation[0] received for message with result = MESSAGE_TIMEOUT
    message_id: message_0
    correlation_id: correlation_0
    Properties: {'Property': 'PropMsg_0'}
    Total calls confirmed: 1
Confirmation[1] received for message with result = MESSAGE_TIMEOUT
    message_id: message_1
    correlation_id: correlation_1
    Properties: {'Property': 'PropMsg_1'}
    Total calls confirmed: 2
Confirmation[2] received for message with result = MESSAGE_TIMEOUT
    message_id: message_2
    correlation_id: correlation_2
    Properties: {'Property': 'PropMsg_2'}
    Total calls confirmed: 3
Confirmation[3] received for message with result = MESSAGE_TIMEOUT
    message_id: message_3
    correlation_id: correlation_3
    Properties: {'Property': 'PropMsg_3'}
    Total calls confirmed: 4
Confirmation[4] received for message with result = MESSAGE_TIMEOUT
    message_id: message_4
     correlation_id: correlation_4IoTHubClient sending 5 messages

有没有人知道为什么我会收到所有TIMEOUT消息?
谢谢

1 个答案:

答案 0 :(得分:-1)

尝试将协议更改为HTTP 例如:

PROTOCOL = IoTHubTransportProvider.HTTP