Is there any hard limit on TCP's window size? If not how can I increase it?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MoNo_2793136
Level 2
Level 2

I am using the Murata reference board which is based on the 4343W. Currently, I measured the effective TCP throughput at 4.3 Mega Bits/second. My test scenario consists of an Android phone transferring a file to the WICED reference board through a TCP socket.  The Wireshark capture file (from the WiFi sniffer) indicates that when the link is setup, both Android and WICED have a matching MSS (Max Segment Size) set to 1460 but the Android advertises its TCP Window size to be at 256 but the WICED's TCP size is at 1. I am thinking about setting the WICED's Window size to 3 or 5 in order to increase the TCP throughput. What is the WICED's hard limit for the TCP's Window size? How can I increase WICED's TCP Window size?

Thanks, Mohammad

0 Likes
1 Solution

By default WICED uses 7 Kb window size as specified WICED_DEFAULT_TCP_WINDOW_SIZE in 43xxx_Wi-Fi/include/wiced_defaults.h.

Based on your host (assuming STM32F412), you can change the WS by using GLOBAL_DEFINES += WICED_TCP_WINDOW_SIZE=131072 in your application makefile.

View solution in original post

2 Replies
MoNo_2793136
Level 2
Level 2

I made a mistake in my original post. The Android phone advertises its Window Scaling factor to be WS=256 not the actual window size. Essentially, the window scaling simply extends the 16-bit TCP Window size. Since the size of the Window field in the TCP header is 16 bits then the max value of the window is limited to 65535. The scaling factor is used to increase the Window size to values above 65535.

So the hard limit of the Window size is the Max window size ( max  value of 16 bit=65535) multiplied by the scaling factor.

The Window size is also dependent on the delay between the client and the server. Let's assume both the client and the server advertise the maximum window size of 65,535 bytes ( max value of a 16-bit). But if the link between the two is 20 Mega bits per second and the delay is 40 millisecond, then, the amount of data that can be in flight is (20,000,000*delay)/8 = 100k Bytes. So, the window is 100,000  bytes but the max value of the 16 bit window field is 65535, then, in this case the scaling factor can be used to increase the window size to 100 KB.

It should be noted the window size can be dynamically adjusted by modifying the value of the window field in the TCP header but the scaling factor remains constant.

0 Likes

By default WICED uses 7 Kb window size as specified WICED_DEFAULT_TCP_WINDOW_SIZE in 43xxx_Wi-Fi/include/wiced_defaults.h.

Based on your host (assuming STM32F412), you can change the WS by using GLOBAL_DEFINES += WICED_TCP_WINDOW_SIZE=131072 in your application makefile.