#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ADDRESS "tcp://localhost:1883"
#define CLIENTID "ExampleClientPub"
#define TOPIC "MQTT Examples"
#define PAYLOAD "Hello World!"
#define QOS 1
#define TIMEOUT 10000L
int finished = 0;
void connlost(void *context, char *cause)
{
int rc;
printf("\nConnection lost\n");
printf(" cause: %s\n", cause);
printf("Reconnecting\n");
{
printf("Failed to start connect, return code %d\n", rc);
finished = 1;
}
}
{
printf("Successful disconnection\n");
finished = 1;
}
{
int rc;
printf(
"Message with token value %d delivery confirmed\n", response->
token);
{
printf("Failed to start sendMessage, return code %d\n", rc);
exit(EXIT_FAILURE);
}
}
{
printf(
"Connect failed, rc %d\n", response ? response->
code : 0);
finished = 1;
}
{
int rc;
printf("Successful connection\n");
deliveredtoken = 0;
{
printf("Failed to start sendMessage, return code %d\n", rc);
exit(EXIT_FAILURE);
}
}
int main(int argc, char* argv[])
{
int rc;
{
printf("Failed to start connect, return code %d\n", rc);
exit(EXIT_FAILURE);
}
printf("Waiting for publication of %s\n"
"on topic %s for client with ClientID: %s\n",
PAYLOAD, TOPIC, CLIENTID);
while (!finished)
#if defined(WIN32) || defined(WIN64)
Sleep(100);
#else
usleep(10000L);
#endif
return rc;
}
*