should every TCP data packet be acknowledge or not?

1

1

If a tcp program A send two data packets to another TCP program B, packet 1: sequence number from 1000 to 2000; packet 2: seq number from 2000 to 3000.

Generally B should reply with 2 ACKs, one for acknowledging packet 1 and the other for packet 2. Now, if only the second ACK is received by A, will A still wait for the first ACK or not?

I know TCP is byte-oriented stream protocl. so A should not wait for the first ACK, is it right? In theory, it is like this, how about the real implemented TCP stack?

BTW, I have a pecular question. If A send to B an ACK to with ack seq number 3001(this is for acknowledging packet 2). But someone in the middle modify the ack seq number to 2501, that's being said, B acknowledge a half TCP packet. Then will A retransmit from byte which corresponds to seq 2000 or 2501?

misteryes

Posted 2013-05-27T12:26:54.913

Reputation: 2 255

Question was closed 2013-06-04T14:58:23.373

Answers

3

No, TCP applies a "sliding window" mechanism to reduce the number of acknowledgments needed.

A nice visualization and explanation: http://histrory.visualland.net/tcp_swnd.html

Axel Kemper

Posted 2013-05-27T12:26:54.913

Reputation: 2 892

This is theory, how about the practical, I mean the TCP stack implementation. And I have a pecular question, pls check my updated question. thanks! – misteryes – 2013-05-27T12:38:28.957

2@misteryes This is also real-world behavior. If you want to see the "practical behavior", install a monitor like Wireshark or consult one of the open-source TCP stacks (e.g. Linux). – Lekensteyn – 2013-05-27T14:22:29.653

6

TCP will ack sequence numbers, not packets. So even without "someone in the middle", Program A can ack just a fraction of a received packet (i.e. socket doesn't have enough buffer space for all of the packet.) In your example, 2501 will then be re-transmitted by Program B.

TCP also supports Selective Ack, so that just a missing segment (in the seq number space) needs to be transmitted

BostonDriver

Posted 2013-05-27T12:26:54.913

Reputation: 452

+1 This answer is wonderful. Right on the spot with the most important scentence at the beginning. I wonder why it has (had) no upvotes. – artistoex – 2013-06-28T16:09:21.437

0

B offers a 'window' (of buffer space) to A in its acknowledgement. A need not wait for a specific acknowledgement before send subsequent packets so long as it doesn't exceed B's current window.

Caveat: Much simplified, both in the interest of brevity and due my somewhat limited understanding of the protocol. RFC: 813 - WINDOW AND ACKNOWLEDGEMENT STRATEGY IN TCP talks about this very technique.

JRobert

Posted 2013-05-27T12:26:54.913

Reputation: 6 128