简体   繁体   English

我使用哪个端口从 Python 向 FairCom MQ 发送 MQTT 消息?

[英]What port do I use to send MQTT messages to FairCom MQ from Python?

I'm trying to send MQTT messages to FairCom MQ using Paho.我正在尝试使用 Paho 将 MQTT 消息发送到 FairCom MQ。 What port would I use?我会使用什么端口?

In my paho.mqtt.publish() call I understand to set hostname to "localhost" or the IP of the machine FairCom MQ is running on but what do I set port to?在我的 paho.mqtt.publish() 调用中,我知道将主机名设置为“localhost”或运行 FairCom MQ 的机器的 IP,但是我应该将端口设置为什么?

1883 is the default port for MQTT in general.一般情况下,1883 是 MQTT 的默认端口。 FairCom MQ defaults to this port, so if you have not changed the MQTT port by editing cthttpd.json in the config folder use 1883. IE FairCom MQ 默认使用此端口,因此如果您没有通过在配置文件夹中编辑 cthttpd.json 来更改 MQTT 端口,请使用 1883。IE

paho.mqtt.publish(topic, payload="My payload", qos=0, hostname="localhost", port=1883) paho.mqtt.publish(topic, payload="My payload", qos=0, hostname="localhost", port=1883)

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

相关问题 如何使用 Mqtt 和 python 将图像作为 json 元素发送? - How do I send an image as a json element using Mqtt and python? 如何配置Python iotc以通过端口443而不是通过端口8883的MQTT使用WebSockets - How can I configure Python iotc to use WebSockets over port 443 instead of MQTT over port 8883 在raspberry pi上发送和接收消息的python mqtt脚本 - python mqtt script on raspberry pi to send and receive messages 如何使用python在端口上嗅探日志消息? - How do I sniff on a port for log messages using python? 为什么我无法从 pythonscript 获取 mqtt 消息,也无法从 Node Red 接收 mqtt 消息? - Why i cant get mqtt messages from pythonscript and cant recieve mqtt messages from Node Red? 如何从lambda函数通过MQTT接收回消息? - How do I recive back messages through MQTT from lambda function? 如何使用celery从rabbit-mq服务器获取消息? - How to use celery to get messages from a rabbit-mq server? 如何从 python 控制台获取输入,以便能够将消息作为 Discord BOT 发送? - How do I take input from the python console to be able to send messages as a Discord BOT? python paho-mqtt-不接收mqtt消息 - python paho-mqtt - Not receiving mqtt messages 我可以使用 Django Channels 实时显示 MQTT 消息吗? - Can I use Django Channels to display MQTT messages in realtime?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM