1.参考文件:https://blog.csdn.net/NRWHF/article/details/131359662
2.安装
sudo apt-get install mosquitto mosquitto-clients
3.配置文件
/etc/mosquitto/mosquitto.conf
***********************
user kd
topic write terminal
topic read host
user yx
topic write host
topic read terminal
***********************
sudo service mosquitto status
sudo service mosquitto start
udo service mosquitto stop
4.订阅消息
mosquitto_sub -t "host" -u "kd" -P "qwe#124!"
5.发布消息
mosquitto_pub -t "host" -m "How old are you?" -u "yx" -P "qwe#124!"
=========================================================
c++
todo...