I am reading about implementations of reliable UDP (ie. sending ACK packets and resending non-ACKed packets again).
Of the two main patterns I seem to find arround the net:
Client sends an ACK for each received packet with the sequence of that packet. Server assumes packet is undelivered unless it receives an ACK.
Client sends an ACK packet with the sequences of the packets it thinks are missing. Server assumes packet is delivered unless it receives an ACK from the client saying it's missing a sequence, then it resends the requested (missing) packets again.
In short, in 1. the clients sends the sequence of the received packets, while in 2. client sends the sequence of the missing packets.
Just wondering what are the pros/cons of each method, and which one is more mainstream (I assume 1, but 2 seems like a very clever method since assumably most packets do arrive and only a few are usually lost).
EDIT: A short example on both methods:
Method 1: Server sends: 1,2,3,4,5
Client received: 1,3,5,4
Client sends back: ACK 1, ACK 3, ACK 5, ACK 4
Server resends: 2.. maybe more if ACK packets were lost
Method 2:
Server sends 1,2,3,4,5,6,7,8
Client receives: 1,3,2,5,7
Client Sends :ACK (lowest continuous 3,highest received 7, seem to be missing 4,6)
Server resends: 4,6,8
#2 is also known as Negative ACK, aka NAK, it is an optimistic viewpoint of a transport. That means is scales better when the transport is functioning correctly.
#1 is a pessimistic viewpoint and assumes a transport will frequently fail.
TCP uses ACKs because there is fundamental dependency on congestion control to drop packets to perform traffic shaping to create a fair network. Reliable UDP channels typically use NAKs because you are using a reliable high speed medium or low rate stream with requirement for low latency over the lock step typical of a basic ACK implementation.
Note if you rise a step higher and look at say subscription management above a reliable UDP channel there is no clear winner for ACK or NAK usage. The market data world has proven usage of both technologies at high speed on high capacity networks. ACKs have the benefit, with subscriptions, that you don't need a complicated re-synchronisation after a network fault, however you will see a consistent peak of network and CPU usage when every host issues a re-subscription.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With