You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
487 B
C
29 lines
487 B
C
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <mosquitto.h>
|
|
|
|
#define QOS 2
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int port;
|
|
struct mosquitto_message *messages;
|
|
|
|
if(argc < 2){
|
|
return 1;
|
|
}
|
|
port = atoi(argv[1]);
|
|
|
|
mosquitto_lib_init();
|
|
|
|
mosquitto_subscribe_simple(&messages, 1,
|
|
true, "qos2/test", QOS, "localhost", port,
|
|
"subscribe-qos2-test", 60, true, NULL, NULL, NULL, NULL);
|
|
|
|
mosquitto_message_free(&messages);
|
|
|
|
mosquitto_lib_cleanup();
|
|
return 0;
|
|
}
|