zoukankan      html  css  js  c++  java
  • LINUX--mosquitto

    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 mosquitto
    sudo 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等其他参数详见文档:

    mosquitto 参数:

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

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

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

    -v--verbose 详细记录信息

    mosquitto_sub 参数:

    mosquitto_pub

  • 相关阅读:
    oracle一次插入多条数据
    SQL在in中传入参数类型问题
    斗鱼刷弹幕定时
    在setTimeout 200ms后执行函数发生错误
    Java去除字符串中的空格
    同步与异步
    HTTP请求中GET和POST的区别
    SQL优化
    什么是死锁以及避免死锁
    常用快捷键
  • 原文地址:https://www.cnblogs.com/straight/p/7663265.html
Copyright © 2011-2022 走看看