码迷,mamicode.com
首页 > Windows程序 > 详细

TCP Sliding Window

时间:2015-11-15 19:23:57      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:

Sliding window is an interesting concept. In terms of TCP, receiver’s window represents the amount of data that the receiver is willing to accept.

In this article, we will cover TCP sliding window concept and aspects related to it.

Quick Sender, Slow Receiver

Before learning the sliding window concept, lets first discuss a scenario where sender is quick to send data while receiver is a bit slow to accept it. Suppose sender sends three data segments (seg1, seg2 and seg3) each of 4096 bytes and starts waiting for the acknowledgement from the receiver.

Now, if these 3 segments fill up all the TCP buffers of the receiver then receiver will advertise a window size of 0. The window size zero means that receiver cannot accept any more data at this moment. Whenever buffers are available, a non zero window size would be advertised by the receiver.

TCP Sliding Window

The process described in last section is good on receiver’s part but sender has to maintain a window on its side too. This window covers unacknowledged data and the data it can send keeping in mind the window size advertised by the receiver.

Following figure should give you an idea about how a sliding window looks like :

技术分享

In the figure shown above :

  • The available window advertised by the receiver is 6. This means that receiver can accept 6 bytes as of now.

  • The window at sender side covers bytes ranging from 13 to 18 (I.e. 6 bytes in total).

  • Out of this range, 13-15 are the bytes which have been sent but no acknowledgement is yet received for them.

  • Bytes 16-18 are the bytes that sender can send as soon as possible.

  • If sender starts receiving acknowledgement for bytes 13 to 15, the left end of the window starts closing in.

  • The right end starts opening up as more and more window size is advertised by the receiver.

  • This window slides towards right depending upon how fast receiver consumes data and sends acknowledgement and hence known as sliding window.

On a related note, it is also helpful for you to understand how TCP attacks andARP cache poisoning works.

Some more points related to sliding windows :

  • The receiver can send acknowledgement even before its window fills up completely.

  • The left edge of the window can move towards right.

  • Neither left edge should move towards left nor right edge should move towards left.


TCP Sliding Window

标签:

原文地址:http://my.oschina.net/robinyao/blog/530563

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!