ADC Home > Reference Library > Technical Q&As > Carbon > Networking >

Changing the TCP Window Size


Q: I'm developing some TCP software for an unusual networking environment (cable modem, satellite link, very fast network, etc) and I've been told that I might get performance benefits by changing the "TCP window size." How do I do this under Open Transport?

A: Technically, the TCP window size is a dynamic value that is calculated on the fly by the TCP software; however, when most people talk about changing the TCP window size, they are referring to the upper bound of this value. Under OT, you can change this upper bound using the XTI level option XTI_RCVBUF.

Note that TCP is a full duplex protocol, and therefore there are two window sizes: one advertised by your machine for incoming data, and another advertised by the remote machine for data that you send it.

You can only directly affect the window size for your receiving side of the TCP connection. There is no way for you to influence the window size advertised by the remote machine without the explicit cooperation of some process on that machine. Depending on your situation, you may need to change this option on the remote machine to achieve the effect you want.

Changing the XTI_SNDBUF size does not impact the TCP window size. Rather, it will impact flow control. XTI_SNDBUF controls the number of bytes which you are allowed to queue at the sender. This includes both unsent bytes as well as sent-but-unacknowledged bytes. If the XTI_SNDBUF limit is large, your endpoint will be allowed to queue more data before you get back an kOTFlowErr.

Technical Q&A NW 28 provides a code snippet that shows how to set an option on a TCP endpoint. You can use similar code to set the XTI_RCVBUF option.

Note that changing these values can yield unexpected results; it's not always a question of "bigger is faster." In certain circumstances (like those given in the question) it may be advantageous to change these values, but this isn't true for all cases. I recommend that you test your application in a variety of realistic circumstances before deciding to ship code that changes the window size.

[Mar 14 1997]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.