简体   繁体   中英

TCP Window Scaling in Windows 7

I'm a beginner for network programming. I read some resources that I could find on the internet, where I came across TCP Window Scaling. As I understood, the scaling factor is negotiated when the connection is first established, in the SYN packet. So does this mean that TCP Window scaling cannot be set by the code that we would write for socket programming? Is it the operating system which does this? Say, in a windows environment, how does this happen and is there a way for us to manually/dynamically change it?

Window scaling is enabled automatically if you set a socket receive buffer size of more than 64k, via setsockopt().

As the window scaling negotiation happens during the connection handshake, you have to do that before connecting the socket. In the case of sockets accepted by a server via a listening socket, this is obviously impossible, so you have to do the apparently odd operation of setting the socket receive buffer size on the listening socket instead, from where it is inherited by all sockets accepted from it.

No, I believe this can only be set at a global level. There is a registry setting for this under the HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Tcpip\\Parameters key.

It's called GlobalMaxTcpWindowSize . See here: http://technet.microsoft.com/en-us/library/cc957546.aspx

If what you actually mean is to change the size of the socket receive and transmit buffers then these can be changed using Winsock. See SO_RCVBUF and SO_SNDBUF .

The window size of TCP packages are managed by the operation system. So far you cannot change that dynamically. For a static way to change the window size for the whole system see Nicks answer.

There is just one very hard way: You WinCap there you can write out every TCP package you want. But that is a real pain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM