Relation TCP acks and MQTT acks

Relation TCP acks and MQTT acks

Is it somehow possible for a MQTT client to receive an MQTT PUBACK message without having received the TCP ack?

for example: The client publishes a message with QoS 1. The broker receives this message and returns the PUBACK. Afterwards, the server's TCP stack also sends out the TCP ack.

答案1

TL;DR: There is no PUBACK without TCP ACK. TCP ACK will be send before or at the same time as PUBACK.

If peer A sends data to peer B then B will TCP ACK these data once they are received by the TCP stack of B. This ACK might be deferred to save bandwidth but whenever data are send from B to A it will be included.

PUBACK gets send by B if a message got received in the MQTT application. In order for the MQTT message to be received the data underlying this message must have been received at the TCP level first. Even if the TCP ACK for these data was not send yet (i.e. deferred) it will be included when the PUBACK is send from B.

相关内容