I'm trying to create mqtt connection using python. The shortest code to reproduce the problem is
import paho.mqtt.client as paho
client = paho.Client('myClient')
client.username_pw_set('user', 'password')
client.connect('my.broker.com')
On the last line I get
ConnectionRefusedError: [Errno 111] Connection refused
Interesting that connection is not refused by server. connect() has logging and it seems that connection is refused before the actual request.
I tried the script on Windows machine and it works fine as well as on Ubuntu, but I need to run it on the machine with Fedora 37 (which refuses the connection). I believe there is some misconfiguration, but I have basic Linux knowledge and don't know where I can look to find it. I don't know current states of both Linuxes, they may be set up somehow, but Windows machine have pretty default settings. I have googled and saw some recomendations like:
- Run local mqtt broker (not suitable for me as I have to connect to the remote broker)
- Check the firewall rules (I believe there is no firewall in the network, as other machines can connect to the broker)
- Check iptables (it shows no filtering rules)
Are there any suggestions on what else I can check? Are there any Fedora-specific or Linux-wide restrictions on socket creation?
my.broker.com? If the server is listening on port 12345, can younc -vvv my broker.com 12345and get aConnected!response?pingshows100% packet loss.ncshows connection refused.