New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Ports Mosquittopp #2984
Comments
Yes, it is possible to achieve communication using different ports for different connections with Mosquittopp. To establish MQTT connections with different ports for different systems, you can create separate instances of mosquittopp::lib objects for each connection, and specify the desired port when connecting to the MQTT broker. Create Separate mosquittopp::lib Instances: Create separate instances of mosquittopp::lib for each MQTT connection you want to establish. Connect to MQTT Broker with Specified Ports: When connecting to the MQTT broker using mosquittopp::lib::connect(), specify the desired port for each connection. For example, use port 1883 for one connection and port 9001 for another connection. Handle Message Communication: Implement message publishing and subscription logic within each instance of mosquittopp::lib as needed for your application. Here's a basic example class MyMosq : public mosqpp::mosquittopp
}; int main()
} |
Hello
I am currently using mosquittopp for CPP to facilitate MQTT message communication. Till now I've been using the default port for TCP/IP communication, 1883. There are 3 systems with one master and 2 slave systems and I would like the master system to communicate using 1883 port to one slave and using 9001 to the other slave.
Could someone help me understand if this is possible using mosquittopp? And if so could you please direct me to some examples on the same to help me implement it?
Thank you in advance
The text was updated successfully, but these errors were encountered: