0

In a distributed system, to ensure the peer has received a message correctly, we may use application level acknowledgement mechanism (ACK).

But when the client and the server is connecting via TCP or WebSocket, if the application level ACK for a sent message is not received by the sender, does it mean the connection is broken and should be reconnected?

Is it possible for the data or application level ACK is missing from application level but actually successfully transmitted in TCP level? (In this case, resending the message may be economical.)

Bill David
  • 95
  • 5
  • TCP handles that for you: "_When the TCP transmits a segment containing data, it puts a copy on a retransmission queue and starts a timer; when the acknowledgment for that data is received, the segment is deleted from the queue. If the acknowledgment is not received before the timer runs out, the segment is retransmitted._" TCP guarantees delivery and in order to the application. – Ron Maupin Jan 22 '21 at 17:13
  • @RonMaupin Yes, I know there is acknowledgement in TCP, that's why it's thought be be more reliable than UDP. But then why do we need ACK in application level? I think application level ACK is necessary for application to know the data sending result. My question is more about when an application level ACK is failed to be received, should the TCP or WebSocket connection be re-connected or the TCP connection should have already been disconnected? – Bill David Jan 23 '21 at 08:20
  • Usually there is application level resending logic for un-acknowledged message. But when you resend, is the connection still alive? – Bill David Jan 23 '21 at 08:30
  • With TCP, your application should not need to ACK. Each side of the connection is assured that anything it sends is received, in order, by the other side. It is like having a direct connection between the applications on each side. UDP does not have connections or any guarantees, so if you need that, you use TCP or build it into an application-layer protocol or the application. – Ron Maupin Jan 23 '21 at 15:48

1 Answers1

0

By tracking the suggested related questions, I have found some good answers on why application level ACK is necessary:

Are application level Retransmission and Acknowledgement needed over TCP?

Can websocket messages get lost or not?

if my application is using tcp protocal? then do i need a retry mechanism in my Application?

So if application level of problem may cause the message (or its application level ACK) can't be received successfully, a retry may be a meaningful remedial measurement.

Bill David
  • 95
  • 5