The Paho MQTT C Client is a fully featured MQTT client written in ANSI standard C. C was chosen rather than C++ to maximize portability. A C++ API over this library is also available in Paho.
In fact there are two C APIs. "Synchronous" and "asynchronous" for which the API calls start with MQTTClient and MQTTAsync respectively. The synchronous API is intended to be simpler and more helpful. To this end, some of the calls will block until the operation has completed, which makes programming easier. In contrast, only one call blocks in the asynchronous API - waitForCompletion. Notifications of results are made by callbacks which makes the API suitable for use in environments where the application is not the main thread of control.
Source archives for releases are available from the Git repository, as is the current source.
Pre-built binaries for Windows, Linux and Mac are available from the downloads page.
The Windows binaries are built with Visual Studio 2013 and 2015. If you don't have the correct version installed already, you will need to install the appropriate Visual C++ Redistributable Package for Visual Studio.
The continuous integration builds can be found on Travis-CI for Linux and Mac, and AppVeyor for Windows.
CMake can also be used - see the readme for details.
cmake -G "NMake Makefiles" -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE ..
Reference documentation is online here.
To see the full list of options, type the utility name without any options.
These C clients connect to a broker over a TCP/IP connection . They cannot be used with other networking APIs. For that, look at the Embdedded C client.
printf("Waiting for up to %d seconds for publication of %s\n"