mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-08 13:41:58 +08:00
29 lines
501 B
C++
29 lines
501 B
C++
#include <cstdlib>
|
|
#include <mosquitto/libmosquittopp.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]);
|
|
|
|
mosqpp::lib_init();
|
|
|
|
mosqpp::subscribe_simple(&messages, 1,
|
|
true, "qos2/test", QOS, "127.0.0.1", port,
|
|
"subscribe-qos2-test", 60, true, NULL, NULL, NULL, NULL);
|
|
|
|
/* FIXME - this should be in the wrapper */
|
|
mosquitto_message_free(&messages);
|
|
|
|
mosqpp::lib_cleanup();
|
|
return 0;
|
|
}
|