加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – mosquitto-client获得拒绝连接

发布时间:2020-12-14 02:07:35 所属栏目:Linux 来源:网络整理
导读:我想使用mosquitto库使用MQTT协议. 首先,我想做一些安装mosquitto-clients的测试 sudo apt-get install mosquitto-clients 该程序提供了两种“方法”: mosquitto_pub mosquitto_sub 按照 this 说明我正在尝试提交新主题: mosquitto_sub -d -t newtopic/tes
我想使用mosquitto库使用MQTT协议.

首先,我想做一些安装mosquitto-clients的测试

sudo apt-get install mosquitto-clients

该程序提供了两种“方法”:

> mosquitto_pub
> mosquitto_sub

按照this说明我正在尝试提交新主题:

mosquitto_sub -d -t newtopic/test

使用默认主机/端口[localhost / 1883].

我获得:

Error: Connection refused

过于通用,因为错误..任何人都可以帮助我吗?
可能是防火墙问题?在这种情况下,我该如何检查这是否是问题?

我正在使用linux ubuntu(3.8.0-42-generic#62~minision1-Ubuntu)

使用libmosquitto编写自定义程序的相同行为.

解决方法

mosquitto_pub / sub的默认主机:端口组合是localhost:1883.如果您没有在本地计算机上运行代理,那么当然它将无法连接.

解决方案是在本地计算机上运行代理,或者告诉实用程序在哪里连接.例如:

mosquitto_sub -t newtopic/test -h test.mosquitto.org

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读