TCP Windowing
By Stephen Bucaro
A TCP session begins with what is referred to as the "three-way handshake". First
the sending computer sends a packet with the SYN (synchronize) flag set. The
receiving computer responds by returning a packet with both the SYN and ACK
(acknowledge) flags set. The first computer then completes the session initialization
by sending a packet with the ACK flag set.
When an amount of data is too large to send in a single packet, it is divided into
segments. One of the things negotiated during the session initialization is the
segment size. The default segment size is 536 octets (groups of 8 bits). TCP then
divides the data into segment size transmissions.
The segment size depends on the the paths MTU (Maximum Transmission Unit).
The MTU is an inherent property of the physical technology. The MTU for standard
Ethernet, for example, is 1500 bytes.
Each segment transmitted contains a "sequence number". The receiving computer
uses these sequence numbers to reassemble the data in the proper order. When
the receiving computer receives a segment of data, it performs an error check
called the CRC (cyclical redundancy check). If the segment was received without
errors, it returns an ACK message indicating that the sending computer should send
another segment.
But that would be inefficient because the sending computer would spend time
waiting for an ACK message before sending the next segment. Instead, the receiving
computer doesn't send an ACK message until it receives a certain number of data
segments. The number of segments received before an ACK message is returned
is called the TCP receive window size. The receive window size is determined by
the receiving device during session initialization.
The sending computer sends the number of packets (each packet containing a data segment)
within the TCP receive window size and starts a timer for each packet. The receiving computer
sends an ACK message for each packet it received without errors. After receiving the ACK
message, the sending computer slides the window to the left.
If the sending computer does not receive an ACK message for a particular packet before
that packets timer times out, it must re-transmit that Segment, resetting its timer.
If the receiving computer encounters too many segment packets with errors, it will
reduce the receive window size.
If the computer encounters very few errors, it will increase the receive window size. This
reducing or increasing of the window size, called TCP Window Scaling, allows the sending
computer to ensure that the data is being sent as fast as the receiving
computer can receive it.
More Networking Protocols and Standards: • Session Border Controllers - More Than Just a Voice Firewall • Understanding IP Routing • IEEE 802 Standards Specify the Basics of Physical and Logical Networking • What Is Fabric Networking? • Basic TCP/IP Networking • A Simple Description of the IPv6 Header and Datagram • Networking Routing Believability and Administrative Distance • Networking Protocols, Ports, Standards, and Organizations What Does it All Mean? • Wireless Network Standards - 80211a, 80211b, 80211g, 80211n, 80216 • T-Carrier - A Complete and Comprehensive Guide
|