Advertisement

TCP protocol question about packet loss

Started by January 09, 2003 05:58 PM
1 comment, last by Coreyh 22 years ago
I wanted to know how tcp handles packet loss. What happens to packets that are after the lost packet? Are they thrown away or kept in a buffer till the lost packet is received? [edited by - coreyh on January 9, 2003 7:13:57 PM]
kdIXfA.gamedev.10.coreyh@xoxy.netwww.ipeg.com/~rlfc
TCP uses what is called a sliding window protocol.. Imagine each letter A-Z is a packet that you''re sending (in A-Z order, obviously), when you tell the OS to send, say, packet G (let''s assume Nageling is off) it sticks in into the next spot available in the "window" as such:

         [-- Window  --] A B C D [ E F G _ _ _ ] 


Packets A,B,C, and D have already been sent and received the appropriate ACK (signalling that the other side recv''ed that packet) Packet E has been sent but the ACK has not been recv''ed.. Packet F has been sent and the ACK may or may not have been recv''ed.. Packet G is currently being sent (and as such obviously hasn''t been ACK''ed).. Of the above, only Packets E, F, and G would be buffered by the TCP stack

Now, if we recv an ACK for packet E, the window "slides over" and discards packet E.. however, if we don''t recv an ACK for that packet, the window can''t slide over.. After a certain time (the timeout) the un-ACKed packet would be resent (some other things happen as well to adapt to the packet loss, such as lengthening the timeout period)

This sliding window is also used to implement receiving packets in order, but you didn''t ask about that so I''ll leave it as an exercise for the reader
Advertisement
Thanks, that information was very helpful.
kdIXfA.gamedev.10.coreyh@xoxy.netwww.ipeg.com/~rlfc

This topic is closed to new replies.

Advertisement