MQTT Client connect fails [message #1779589] |
Tue, 09 January 2018 21:35  |
Eclipse User |
|
|
|
Hi
I am very new to MQTT, and I am trying to use the MQTT libraries as provided by the
Paho-MQTT -C-windows 1.2.0 release
I am using an MS Visual Studio 2015 software to create the solution and i have provided all the necessary includes and linker files.
The MS project builds and when I attempt to run it, the program fails.
the following are my set up
#define ADDRESS "tcp://m2m.eclipse.org:1883 "
#define CLIENTID "ExampleClientPub"
#define TOPIC "MQTT test"
#define PAYLOAD "Hello World!"
#define QOS 1
#define TIMEOUT 10000L
Stepping through the code, the project always fails at rc = -1
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
{
printf("Failed to connect, return code %d\n", rc);
exit(-1);
}
What am I doing wrong? are the ADDRESS and CLIENTID values wrong?
Thank you in advance
Liwaa
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04144 seconds