← Back to team overview

mosquitto-users team mailing list archive

Re: example subscriber in C

 

Hi Tim,

As Sven mentioned, the mosquitto_publish and mosquitto_subscribe clients sources are provided in the client folder of the sources.
So you can just extract what you want from the sub_client.c file to match your need.

Remi

De : Mosquitto-users [mailto:mosquitto-users-bounces+remi.salembier=niji.fr@xxxxxxxxxxxxxxxxxxx] De la part de Sven Klaassen Bos
Envoyé : jeudi 5 décembre 2013 17:10
À : Tim Champion
Cc : mosquitto-users@xxxxxxxxxxxxxxxxxxx
Objet : Re: [Mosquitto-users] example subscriber in C

Hi,

When you download the source code on the mosquitto site, there is a working publisher and subscriber in the client subfolder. Both written in C.

Hope that helps!

Greetings,
Sven

2013/12/5 Tim Champion <tim@xxxxxxxxxxxxxxxxxxx<mailto:tim@xxxxxxxxxxxxxxxxxxx>>
Hi, I'm looking for a working example subscriber in C. I have working code that can publish in C, and I can subscribe on the command line, and that works.

What I can't find is an example C program that does something simple like receive messages and spit them back out to the screen.  My program will add the message payload to a work queue, but that's not the problem I'm having.

I tried the code at the bottom of this page: http://mosquitto.org/man/libmosquitto-3.html but it doesn't seem to work.

mosquitto_lib_version returns 1.2.2 if that helps.

Tim Champion
tim@xxxxxxxxxxxxxxxxxxx<mailto:tim@xxxxxxxxxxxxxxxxxxx>

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to     : mosquitto-users@xxxxxxxxxxxxxxxxxxx<mailto:mosquitto-users@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Follow ups

References