简体   繁体   English

如何使mosquitto_sub打印特定消息的发布者的ip地址

[英]How to make mosquitto_sub print ip address of publisher of particular message

How to make mosquitto_sub print ip address of publisher of particular message: 如何使mosquitto_sub打印特定消息的发布者的ip地址:

$ mosquitto_sub -h localhost -t "#" -u "user" -P "pass" -v

home/sensor/esp1/Temperature 21.2
home/sensor/esp1/Humidity 46.0

If there is way to show ip adress of publisher which sends this message? 是否有办法显示发送此消息的发布者的IP地址?

You can not. 你不能。

There is no information about the publisher in a MQTT message, so the information is just not available unless you choose to encode it in the actual payload. MQTT消息中没有有关发布者的信息,因此除非您选择在实际有效负载中对​​其进行编码,否则该信息将不可用。

A MQTT message just contains the topic, the payload and some flags to show QOS and retained status and that is all MQTT消息仅包含主题,有效负载和一些标志以显示QOS和保留状态,仅此而已

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM