[ee122] question about winsize and ack in tcp

vern at cs.berkeley.edu vern at cs.berkeley.edu
Wed Nov 21 18:19:49 PST 2007

> 1 - if i advertise a window size of zero will the other side of the
> connection stop to send packages?

Yes.  (The other side still might retransmit data that's below what's been
acknowledged, if it hasn't received the acknowledgments.)

(Note, there's an issue which is how does the other side start sending
again.  Clearly, it needs to receive a "window update" acknowedgment that
now advertises a window > 0.  TCP sends these whenever it finds that it
now has some buffer space available.  However, acks are *not* reliably
delivered, so in fact the sender might not receive this and remain hung.
Because of this, TCP actually has a mechanism termed "zero window probe"
by which the sender essentially asks the receiver "is the window really
still zero?".  But this is a detail we haven't covered.)

> 2 - if i have a window size that can fit 5 packages and i receive
> packet 1 2 4 5, when i send the second duplicate ack, do i advertise a
> windowsize of 0 or of 1 ?

The window size is always with respect to what's being acknowledged.
So in this case the acks would all be for packet 2 and would advertise
a window of 5, since the receiver doesn't have to buffer 1 or 2 any more,
and so can accept up to 7.

> 3 - is it correct to always try to send the min(CWND, windowsize)?

Yes, that's how TCP determines it's current sending window, per the
pseudo-code sent to the list a little while ago.


More information about the ee122 mailing list