I installed mosquitto 1.5.7 on Windows 7 and made it subscribe and publish successfully on a local host but mosquitto failed to make connection to ubidot the publish

mosquitto_pub -h "things.api.ubidots.com" -t "/v1.6/devices/plc" -u "token user" -p 1883 -q 1 -m '{"water level":17}' 

gives the result

“Unable to connect (Lookup error.).

and when trying

mosquitto -c configfile

the result is

Error: Unable to open config file
Error found at configfile:0.
Error: Unable to open configuration file

I need to connect MQTT to OPC server for connect my PLC to IoT.

When I enter mosquitto -v I get this messages:

C:\Program Files\mosquitto>mosquitto -v
1550907715: mosquitto version 1.5.7 starting
1550907715: Using default config.
1550907715: Opening ipv6 listen socket on port 1883.
1550907715: Error: Only one usage of each socket address (protocol/network address/port) is normally permitted.
  • 1
    did you check the ubidots API before you posted your question?
    – jsotola
    Commented Feb 24, 2019 at 23:18

1 Answer 1


First, when you try to publish to things.api.ubidots.com it fails because that is not a valid hostname, it does not resolve to an IP address (you can test this with nslookup things.api.ubidots.com).

Second, the config file you pass to mosquitto needs to exist and either needs to be in the same directory you are running the command from, or it needs to be the full path. In the example given configfile does not exist so mosquitto won't start.

Third, when you run mosquitto -v it is trying to start with the default settings, it is failing because mosquitto is already running. When you install mosquitto on Windows it installs it's self as a Windows service and starts automatically, this is why you can not attach to port 1883, because the service is already bound to that port.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.