Linux mosquitto installation and use

The installation instructions are as follows

  1. sudo apt-get update
  2. sudo apt-get install mosquitto
  3. sudo apt-get install libmosquitto-dev
  4. sudo apt-get install mosquitto-clients

Test Methods

  1. Through the mosquitto -p 5678 -v command, a server service with port number 5678 can be established locally;
  2. Use the ifconfig command to view the ip address of the current device;
  3. Install Mqttfx on another computer in the LAN, and set the ip address and port number to be consistent with the computer that starts the mqtt service, then subscribe to a topic on Mqttfx, and then send the same topic on Mqttfx, if the Mqttfx subscription is on If it can be received, it means that the service is available;
  4. If you don’t want to use another host, you can open two more terminals, enter mosquitto_sub -v -p 5678 -t anchor/tag in one terminal, -p specifies the port number, -t specifies the topic, meaning It is to subscribe to the service whose port number is 5678 and the subject is anchor/tag on the machine; then on another terminal, enter mosquitto_pub -t anchor/tag -m 13, where -t sets the sending topic and -m sets the sending content , if the network is normal, then 13 will be received on the receiving terminal;

Guess you like

Origin blog.csdn.net/u012850592/article/details/103406041