MQTT之mosquitto

0.简介

mosquitto是mqtt协议的c语言开源版本。

1.安装

1.1 apt安装

sudo apt-get install mosquitto  #mqtt broker
sudo apt-get install mosquitto-clients #mosquitto_sub and mosquitto_pub
#sudo apt-get install libmosquitto-dev  #用于开发使用
#sudo apt-get install libmosquittopp-dev #C++版封装的libmosquitto

1.2 源码安装

  • mosquitto官网:http://mosquitto.org

  • mosquitto官网下载列表:http://mosquitto.org/files/source/

wget https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz
tar zxfv mosquitto-2.0.15.tar.gz
cd mosquitto-2.0.15
make #linux下直接make,win和mac运行cmake
#sudo make install

2.运行

2.1 broker操作命令

1)查看状态

sudo service mosquitto status

2)启动服务器

sudo service mosquitto start

3)关闭服务器

sudo service mosquitto stop

2.2 client操作命令

TODO:

  • https://blog.csdn.net/JKL852qaz/article/details/123163213

  • https://blog.csdn.net/lizhiwei309/article/details/126636394

  • https://www.cnblogs.com/qumogu/p/16007609.html

  • https://blog.csdn.net/shagoo/article/details/7910598

  • https://www.imooc.com/article/40138

  • https://www.jianshu.com/p/2b7ed9859033

你可能感兴趣的:(Server,mosquitto,mqtt)