博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
LINUX--mosquitto
阅读量:4498 次
发布时间:2019-06-08

本文共 888 字,大约阅读时间需要 2 分钟。

1、 安装mosquitto

sudo apt-get install mosquitto mosquitto-clients

2、 卸载mosquitto

(1) 卸载mosquitto

sudo apt-get remove mosquitto

(2) 卸载mosquitto及其依赖文件

sudo apt-get remove --auto-remove mosquitto

(3) 删除配置文件

sudo apt-get purge mosquittosudo apt-get purge --auto-remove mosquitt

3、 mosquitto运行流程

(1) 机器3运行mosquitto –p 4840 命令,建立MQTT Server,-p指定监听端口,不指定情况下默认监听端口1883。

(2) 机器2运行client1:  mosquito_sub –h 10.111.111.111 –p 4840 –t test,建立一个订阅。-h指定要连接的MQTT Server主机地址,-t指定订阅的MQTT topic。

(3) 机器1运行client2:  mosquito_sub –h 10.111.111.111 –p 4840 –t test,建立一个topic为test的订阅。

(4) 机器1另开一个窗口,运行 mosquito_pub –h 10.111.111.111 –p 4840 –t test –m hello,word,建立发布。-m指定要发布的message。

(5) client1与client2收到发布的消息hello,world。

mosquitto等其他参数详见文档:

 参数:

-c--config-file 从文件中载入配置

-d--daemon 作为守护进程,后台运行mosquitto

-p--port 在指定的端口上监听,默认是1883

-v--verbose 详细记录信息

 参数:

 

转载于:https://www.cnblogs.com/straight/p/7663265.html

你可能感兴趣的文章
springboot入门
查看>>
MATLAB的符号运算基础
查看>>
继续截取长文本显示省略号(多行)
查看>>
python字符串连接的N种方式
查看>>
android脚步---简单图片浏览器改变图像透明度
查看>>
mysql中insert into select from的使用
查看>>
【Luogu】P2536病毒检测(Trie上DP)
查看>>
上传文件
查看>>
typeof
查看>>
@Mapper 和 @MapperScan 区别
查看>>
Unity笔记(3)自学第二天
查看>>
[NOIP2013] 华容道
查看>>
(转)java并发编程--Executor框架
查看>>
算法竞赛入门经典 2.2 循环结构程序设计
查看>>
sql server 2000/2005 判断存储过程、触发器、视图是否存在并删除
查看>>
mysql 隔离级别 脏读 测试
查看>>
Datagridview获取列名为“”的值
查看>>
Python 爬虫的工具列表 附Github代码下载链接
查看>>
IE6/7中li浮动外边距无法撑开ul的解决方法
查看>>
SOS团队介绍
查看>>