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: • Unicast, Multicast, Broadcast. What Does It Mean? • IPv6 Anycast Addresses • DSL (Digital Subscriber Line) • IP Addressing and Subnetting • IPv6 Address Format • How to Set Up FTP (File Transfer Protocol) • VTP (VLAN Trunking Protocol) • Major Protocols in the TCP/IP Suite • IEEE 802.11.x Wireless Standards • Ports and Sockets
|