nuttx-apps/examples/mqttc
Norman Rasmussen ec93611307 examples/mqttc: Fix handling of getaddrinfo errors
commit 36d4bfa774 set a hostname to work
around getaddrinfo failing. getaddrinfo returns a non-zero value on
error, and there should be an early return after the error message is
printed.
2021-12-29 02:45:47 -06:00
..
Kconfig
Make.defs
Makefile
mqttc_pub.c examples/mqttc: Fix handling of getaddrinfo errors 2021-12-29 02:45:47 -06:00
README.md

This is a simple MQTT publisher example using MQTT-C

By default it publishes to the "test" topic and exits. Default behaviour including, host, port, topic, message and loop count can be changed through different arguments.

To test: From the host start an MQTT broker and subscribe to the "test" topic. Here mosquitto is used:

mosquitto&
mosquitto_sub -t test

Make sure that mosquitto is not configured in local mode only.

From the nsh:

Launch the built-in app mqttc_pub specifying the host:

mqttc_pub -h HOST

The target will publish the message "test".