Ahmed Al-haddad
Ahmed Al-haddad

Reputation: 833

Socket.error: [Errno 10060] when connecting to MQTT broker

I am trying to connect to my MQTT broker that is located on a Raspberry Pi. I am trying to publish to the RPi remotely using Wifi on my laptop. I have already verified that I can connect to the Raspberry Pi by connecting to it through SSH - port 22. However, when I try to run my code I get this error and apparently I fail to connect to the broker. Is there a way to fix this?

  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

Upvotes: 1

Views: 2460

Answers (1)

ralight
ralight

Reputation: 11608

A timeout message at the socket level suggests that your firewall is blocking port 1883.

Upvotes: 2

Related Questions