shiv patil
shiv patil

Reputation: 139

What are advantages of MQTT over TCP/IP? Since MQTT is based on TCP, Why don't we use TCP/IP instead of it?

I am studding the MQTT & TCP/IP protocol.

Since i'm able to know that, MQTT is based on the TCP so as the TCP/IP & we refer MQTT though we have the TCP/IP Protocol.

Why don't we use TCP/IP instead of MQTT?

Is there any advantages of MQTT that makes it better solution than the TCP/IP protocol?

Which is more reliable & required less no of data packet to form a communication?

(Note : TCP/IP in the sense forming a network between 2 devices using normal TCP/IP protocol as in GSM modems "connect > transfer data > disconnect")

Upvotes: 9

Views: 16349

Answers (2)

Mukund V Dharwadkar
Mukund V Dharwadkar

Reputation: 1

The benefits of using MQTT over TCP/IP far outweighs the data overhead it introduces. Also, MQTT was devised to solve a specific problem of getting sensor data from a remote system which could not be connected to the consumer of the sensor data all the time.

Upvotes: -1

CodeCaster
CodeCaster

Reputation: 151720

Is there any advantages of MQTT that makes it better solution than the TCP/IP protocol?

Yes, it offers things TCP doesn't offer, namely an application layer protocol. Other examples of such protocols are FTP, HTTP, SMTP.

You're asking the wrong question. IP makes sure you can send data to another machine, TCP makes sure this data is received in-order and acknowledged, and application-level protocols make sure you can make sense of the data you receive.

Without an application level protocol, you have no meaningful communication. Where each sockets programming example begins with "WriteLine" and "ReadLine" text message exchanges, that in itself is (albeit a very rudimentary) application level protocol, namely "client and server exchange text messages ending in a newline".

So, no, you cannot use TCP/IP without an application level protocol, because as soon as you start writing a program sending and/or receiving data, you have at that moment defined an application level protocol.

With its own problems. And that's why you shouldn't invent your own protocol, but use existing ones. Pick the one that suits your needs. Do you need to publish or subscribe messages to some broker, use MQTT.

Unless you know very well what you're doing, don't invent your own.

Upvotes: 12

Related Questions