Problem in MQTT paho C

42 views
Skip to first unread message

shakti gupta

unread,
Sep 28, 2016, 6:07:01 AM9/28/16
to MQTT
Hello,
      I am new to MQTT. i am trying to publish and subscribe some data. but i am facing some problem. I am using eclipse paho C library. In Ubuntu, i have use following commands.

cd org.eclipse.paho.mqtt.c.git
make
sudo make install

it create a repository of name paho.mqtt.c. i import this repository as project in eclipse.it has directory sample, in which i create sample_publisher.c, sample_subscriber.c and sample_subscriber.h.
i have attached code of these files. when i run exe of sample_publisher, it is publishing message "Hello". but in case of sample_subscribe, sometimes it show connection lost, and sometimes it show message string "CRASHED".

I have some doubts about it. i just execute both publisher and subscriber exe. Do i need to do soothing to start or to connect with server. In my code, i am using Address "tcp://m2m.eclipse.org:1883". Or should i need to install server/broker in my system? 

Please have a look in to my sample code and help me to find my mistakes.

Thank You.
Shakti Gupta
 
sample_publisher.c
sample_subscribe.c
sample_subscribe.h
Reply all
Reply to author
Forward
0 new messages