Socket.error:[Errno 10060]连接到MQTT代理时

时间:2016-04-16 04:50:11

标签: python sockets

我正在尝试连接到位于Raspberry Pi上的MQTT代理。我正在尝试使用笔记本电脑上的Wifi远程发布到RPi。我已经验证我可以通过SSH - 端口22连接到Raspberry Pi来连接它。但是,当我尝试运行我的代码时,我收到此错误,显然我无法连接到代理。有没有办法来解决这个问题?

  Traceback (most recent call last):
  File "F:/multi_mqtt.py", line 55, in <module>
    client.connect('10.xxx.xxx.xxx', 1883, 60)
  File "C:\Python27\lib\site-packages\paho\mqtt\client.py", line 612, in connect
    return self.reconnect()
  File "C:\Python27\lib\site-packages\paho\mqtt\client.py", line 734, in reconnect
    sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
  File "C:\Python27\lib\socket.py", line 571, in create_connection
    raise err
socket.error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

1 个答案:

答案 0 :(得分:1)

套接字级别的超时消息表明您的防火墙阻止了端口1883。