mosquitto_pub是否将二进制文件转换为ASCII? [英] Does mosquitto_pub convert a binary file to ASCII?

查看:429
本文介绍了mosquitto_pub是否将二进制文件转换为ASCII?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对MQTT协议还很陌生,如果我的问题听起来很愚蠢,对不起.我正在从设备发布图像,当我在CLI上订阅该图像时,我可以看到一些不是二进制格式的字符.所以我的问题是,图像在发布时默认情况下会转换为ASCII格式然后发送还是以ASCII格式或其他某种格式接收?

I am quite new to MQTT protocol and I am sorry if my question sounds stupid. I am publishing an image from a device and when I subscribe to it on CLI I can see some characters which are not in the binary format. So my question is when the image is published does it by default get converted to ASCII format and then sent or is it received in the ASCII format or some other format?

我给出的发布命令是:

mosquitto_pub --cafile/home/pi/nirupama/rootCA.pem --cert/home/pi/nirupama/certificate.pem --key/home/pi/nirupama/private.pem -h xxxxxxxxxxxxxx.iot.us -west-2.amazonaws.com -p 8883 -q 1 -d -t $ aws/things/raspberry-pi/shadow/update -i mqtt_test -f/media/webcam/picture.jpg

mosquitto_pub --cafile /home/pi/nirupama/rootCA.pem --cert /home/pi/nirupama/certificate.pem --key /home/pi/nirupama/private.pem -h xxxxxxxxxxxxxx.iot.us-west-2.amazonaws.com -p 8883 -q 1 -d -t $aws/things/raspberry-pi/shadow/update -i mqtt_test -f /media/webcam/picture.jpg

subscribe命令是:

The subscribe command is:

mosquitto_sub --cafile/home/pi/nirupama/rootCA.pem --cert/home/pi/nirupama/certificate.pem --key/home/pi/nirupama/private.pem -h xxxxxxxxxxxxxx.iot.us -west-2.amazonaws.com -p 8883 -q 1 -d -t $ aws/things/raspberry-pi/shadow/update -i mqtt_test1

mosquitto_sub --cafile /home/pi/nirupama/rootCA.pem --cert /home/pi/nirupama/certificate.pem --key /home/pi/nirupama/private.pem -h xxxxxxxxxxxxxx.iot.us-west-2.amazonaws.com -p 8883 -q 1 -d -t $aws/things/raspberry-pi/shadow/update -i mqtt_test1

推荐答案

JP Mens在MQTT邮件列表上回答了这个问题: https://groups.google.com/forum/#!topic/mqtt /MIwf0-Bi9yM

This question was answered on the MQTT mailing list by JP Mens: https://groups.google.com/forum/#!topic/mqtt/MIwf0-Bi9yM

答案是,二进制协议中的MQTT及其有效载荷不会转换为ASCII或任何其他文本格式.您确实应该能够发送二进制图像有效载荷而不会损坏.

The answer is that MQTT in a binary protocol and they payloads are not converted to ASCII or any other text format. You should indeed be able to send binary image payloads without corruption.

这篇关于mosquitto_pub是否将二进制文件转换为ASCII?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆