通讯模组-SSL-MQTT连接异常相关问题



31 connection refused: not authorized
客户连接报错31,客户检查clientid/username/password正确。
使用的是ssl加密,需要配置SNI:sAPI_SslSetContextIdMsg("enableSNI", 0,1)

客户问题案例1:

客户log如下:
AT+CSSLCFG="sslversion",0,4
AT+CSSLCFG="authmode",0,0
AT+CSSLCFG="enableSNI",0,1
AT+CMQTTSTOP
AT+CMQTTSTART
AT+CMQTTDISC=1,60
AT+CMQTTREL=1
AT+CMQTTACCQ=1,"16MK16000668"
AT+CMQTTCFG="checkUTF8",1,0
AT+CMQTTCONNECT=1,"tcp://mqtt.njgn.com:8883",60,1,"16MK16000668","HrQfalxGrYv82Kc70eoeotXz8eyl"
+CMQTTCONNECT: 1,15
ERROR
看日志,连接报错Code15:require connection fail

查看IP包是在连接的时候被服务器强制踢掉了

查看log连连接的域名端口是8883,一般是这个端口是ssl加密连接的,但是客户没有配置为ssl加密。
请同客户确认下,是否需要ssl加密连接,如果需要的话,需要配置为AT+CMQTTACCQ=1,"16MK16000668",1
拓展:
AT+CMQTTACCQ=<client_index>,<clientID>[<server_type>]
<client_index> :
A numeric parameter that identifies a client. The range of permitted
values is 0 to 1
<clientID>:
The UTF-encoded string. It specifies a unique identifier for the client.
The string length is from 1 to 128 bytes.
<server_type>:
A numeric parameter that identifies the server type. The default value
is 0.
0 MQTT server with TCP
1 MQTT server with SSL/TLS

参考文献:
[1]:https://mp.weixin.qq.com/s/Rz2g51DpmrARJ3eqPoDvnA
[2]:https://mp.weixin.qq.com/s/0bh2_buVXD_u2l3w19c0ew
[3]:https://mp.weixin.qq.com/s/v8V4ZpCMrnhKVtjVu5TvbQ
[4]:https://mp.weixin.qq.com/s/0bh2_buVXD_u2l3w19c0ew
[5]:https://yebd1h.smartapps.cn/pages/blog/index?blogId=112142716&_refluxos=a10&_swebfr=26&_swebFromHost=bdhonorbrowser
[6]:https://yebd1h.smartapps.cn/pages/blog/index?blogId=106864282&_refluxos=a10&_swebfr=26&_swebFromHost=bdhonorbrowser

posted @   anhuizjh  阅读(36)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示