TCP breaks the information that it sends to segments ... essentially segments are pieces of data that do not exceed the current TCP MSS (maximum segment size) received from the other end. These pieces have increasing sequence numbers (based on the total number of bytes of data sent in the TCP session), which let TCP know when something is lost in flight; the first TCP sequence number is randomly selected and should not be a pseudo-random number for security purposes. In most cases, the MTU of your local ethernet is less than the MSS, so they can send you several segments before you can use the ACK.
It is useful to think about these things in the sequence of time they got standardized ...
First came Positive Acknowledgment , which is a mechanism for transmitting data to the sender, and the ACK sequence number with it is the maximum sequence of bytes received per TCP piece (aka segment). sent.
Below I will show, but in my examples you will see small numbers of TCP segments, such as 1,2,3,4,5 ... in fact, these byte ordinal numbers will be large, increase and have gaps between them (but this is normal. .. TCP usually sends data into chunks of at least 500 bytes long).
So, suppose the sender x sends the segment numbers 1,2,3,4,5 before sending your first ACK. If everything goes well, you send ACK for 1,2,3,4,5, and life is good. If 2 is lost, everything will be suspended until the sender realizes that 2 was never ACK'd; he knows, because you send duplicate ACKs for 1. After the appropriate timeout, the sender xmits 2,3,4,5 again.
Then, selective confirmation was proposed as a way to make this more effective. In the same example, you have ACK 1 and SACK segments 3 through 5 with it (if you use a sniffer, you will see something like "ACK: 1, SACK: 3-5" for ACK packets from you). Thus, the sender knows that he only needs to retransmit the TCP segment 2 ... so that life is better. Also, note that SACK determined the edges of the adjacent data you received; however, several non-contiguous data segments may be simultaneously SACK'd.
Negative acknowledgment is a mechanism for notifying the sender of only missing data. If you do not tell them that something is missing, they continue to send data "until you cry uncle."
Hth, \ m