Home > Common Problem > body text

What is the difference between mqtt protocol and tcp protocol

青灯夜游
Release: 2023-01-13 00:36:06
Original
21573 people have browsed it

Differences: 1. MQTT was born in the early days of the Internet in 1999, and the TCP protocol was born in 1974 during the Cold War. 2. TCP is the transport layer communication protocol of the fourth layer of OSI, and MQTT is an application layer protocol based on TCP. 3. The core idea of ​​TCP is packet switching, and the core idea of ​​MQTT is simplicity and adaptability to the Internet of Things environment.

What is the difference between mqtt protocol and tcp protocol

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

The difference between MQTT and TCP

Birth time

The TCP protocol was born in 1974 during the Cold War.

MQTT was born in the early days of the Internet in 1999, and the TCP protocol was 25 years earlier than the MQTT protocol.

Ashton proposed the IoT concept in 1999, so the MQTT protocol was born at the right time. At that time, Kevin Ashton of MIT Auto-ID Labs first proposed the concept of IoT in 1999 in order to connect RFID tags in P&G's supply chain to the Internet.

Protocol location

TCP is the transport layer protocol of the fourth layer of OSI.

MQTT is a seven-layer application layer protocol based on TCP.

What is the difference between mqtt protocol and tcp protocol

Protocol positioning

TCP design considers connection-oriented, reliable, byte-based Transport layer communication protocol for streams.

MQTT is an application layer protocol for relatively reliable data transmission under low-bandwidth, high-latency and unreliable networks.

Design Idea

The core idea of ​​TCP is packet switching.

The core idea of ​​MQTT is to be simple and adaptable to the Internet of Things environment.

Transmission unit

The transmission unit of TCP is packet. When the application layer sends a data stream represented by 8-bit bytes to the TCP layer for inter-network transmission , TCP divides the data stream into message segments of appropriate length. The maximum transmission segment size (MSS) is usually limited by the maximum transmission unit (MTU) of the data link layer of the network to which the computer is connected.

The transmission unit of MQTT is a message. The upper limit of bytes of each message is set on the MQTT Broker proxy server. The upper limit of message size exceeding 1M can be set. In this way, you can send thousands of pieces of collected data or relatively large device shadow files with one message.

Technical Challenges

The problem that TCP needs to solve is to deal with network congestion, packet loss, disorder, and duplication in a heterogeneous network environment during the transmission of IP packets. Packages and other issues.

The problem MQTT solves is relatively reliable data transmission under low-bandwidth, high-latency, unreliable networks and limited resource hardware environments.

Quality of Service

TCP is a reliable streaming service. Through the ACK confirmation and retransmission mechanism, it can ensure that all bytes sent are exactly the same when received. , and the byte order is also correct.

MQTT provides three optional QoS service levels for message publishing. The MQTT client and MQTT proxy server ensure the reliability of message transmission through the session mechanism. Developers can choose one of them based on business needs.

Application Case

TCP is used in many Internet applications, such as WWW, email, FTP, SSH, P2P, and streaming media. MQTT is also based on TCP.

MQTT can be used for IoT data transmission, IM chat software, etc.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What is the difference between mqtt protocol and tcp protocol. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!