vritik Posted September 3, 2021 Share Posted September 3, 2021 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 Link to comment Share on other sites More sharing options...
Sensei Posted September 4, 2021 Share Posted September 4, 2021 (edited) Search net for Errno 10060. It is timeout error.. Third parameter is timeout. 60. Did you use such value manually or is it default? Default value can by changed. Use some TCP packet sniffer to see what commands are sent and received. 23 hours ago, vritik said: I have already verified that I can connect to the Raspberry Pi by connecting to it through SSH - port 22. No. You just learnt that you can connect to Raspberry not to the server which is at port 1883. telnet exact IP and exact port to see if there is connection made. TCP sniffer would also tell if script connected or not. This rises the question whether 1883 is the right port? Scan all ports to see which are open. If 1883 is the right port, try connecting with it locally from Raspberry to see whether connection is established. Tutorials "how to setup MQTT server on Raspberry" use localhost as IP, which is typically 127.0.0.1, which is accessible only locally not from remote machines. Edited September 4, 2021 by Sensei Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now