mosquitto/test/lib/cpp/01-unpwd-set.cpp

35 lines
554 B
C++
Raw Normal View History

2014-05-07 22:27:00 +00:00
#include <cstring>
#include <mosquittopp.h>
static int run = -1;
class mosquittopp_test : public mosqpp::mosquittopp
{
public:
mosquittopp_test(const char *id);
};
mosquittopp_test::mosquittopp_test(const char *id) : mosqpp::mosquittopp(id)
{
}
int main(int argc, char *argv[])
{
struct mosquittopp_test *mosq;
mosqpp::lib_init();
mosq = new mosquittopp_test("01-unpwd-set");
mosq->username_pw_set("uname", ";'[08gn=#");
mosq->connect("localhost", 1888, 60);
while(run == -1){
mosq->loop();
}
mosqpp::lib_cleanup();
return run;
}