TCP Sliding Window

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.
时间: 2024-08-14 21:02:02

TCP Sliding Window的相关文章

TCP Silly Window Syndrome

In the topic describing TCP's Maximum Segment Size (MSS) parameter, I explained the trade-off in determining the optimal size of TCP segments. If segments are too large, we risk having them become fragmented at the IP level. Too small, and we get gre

239. Sliding Window Maximum

Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. For example, Given num

Sliding Window Maximum 解答

Question Given an array of n integer with duplicate number, and a moving window(size k), move the window at each iteration from the start of the array, find the maximum number inside the window at each moving. Example For array [1, 2, 7, 7, 8], movin

poj 2823 Sliding Window

poj 2823 Sliding Window 单调队列 单调队列是一个单调的状态(递增,或者递减) 所以需要维护这么一个状态 http://baike.baidu.com/link?url=ZcGM7Hzo8zVQUU6Oqqq18SlCMJ92ts3I1aXwQGDZw_NiDDlzIIV9GKlfs3X1fcHVppZHOU31geHZG4cOcRZOAK 固定 k 区间的单调 队列,求 最小值,如果 两个元素 A B ,如果 A 的 下标 比 B 小,但是 A 的 值 比 B 大,那么在

[LeetCode][JavaScript]Sliding Window Maximum

Sliding Window Maximum Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

lintcode Sliding Window Median

http://www.lintcode.com/en/problem/sliding-window-median/ 最近感觉自己需要让心情平静下来,慢慢做事情,做好实验室的事情保证自己的毕业,同时也要做好题目找到份好工作. 先从写博客开始吧,把做过的题目记下来,写写思路. 这道题我没有用O(n log n)的方法,实际上应该是O(n log k),需要用两个set互相之间倒数据就可以了,判断起来比较烦. 直接用map也能够通过,线性查找sliding window的中间值,得到结果.每次进入新元

POJ2823 Sliding Window(单调队列)

单调队列,我用deque维护.这道题不难写,我第二次写单调队列,1次AC. ----------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<deque> #define rep(i,r) for(int i=0;i<r;i++) #define clr(x,c) memset

ACM-单调队列之Sliding Window——poj2823

Sliding Window Time Limit: 12000MS   Memory Limit: 65536K Total Submissions: 36326   Accepted: 10762 Case Time Limit: 5000MS Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left

[ACM] poj 2823 Sliding Window(单调队列)

Sliding Window Time Limit: 12000MS   Memory Limit: 65536K Total Submissions: 36212   Accepted: 10723 Case Time Limit: 5000MS Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left