background image
TCP/IP Protocols
221
Figure 5-5 depicts the same scenario, but the second TCP segment was lost or in error. The Web
server's reply has an ACK field equal to 2000, implying that the Web server is expecting byte
number 2000 next. The TCP function at the Web client could then recover lost data by resending
the second TCP segment. The TCP protocol allows for resending just that segment and then
waits, hoping that the Web server will reply with an acknowledgment that equals 4000. TCP
also allows the resending host to begin with a segment in error and resend all TCP segments.
Figure 5-5
TCP Acknowledgment with Errors
Flow Control Using Windowing
TCP implements flow control by taking advantage of the sequence and acknowledgment fields
in the TCP header, along with another field called the
window
field. This window field implies
the maximum number of unacknowledged bytes outstanding at any instant in time. The window
starts small and then grows until errors occur. The window then "slides" up and down based on
network performance. When the window is full, the sender will not send, which controls the
flow of data. Figure 5-6 shows windowing, with a current window size of 3000. Each TCP
segment has 1000 bytes of data.
Notice that the Web client must wait after sending the third segment because the window is
exhausted. When the acknowledgment has been received, another window can be sent. Because
there have been no errors, the Web server grants a larger window to the client, so now 4000
bytes can be sent before an acknowledgment is received by the client. In other words, the
window field is used by the receiver to tell the sender how much data it can send before the next
acknowledgment. As with other TCP features, windowing is symmetrical--both sides send and
receive, and in each case the receiver grants a window to the sender using the window field.
Web
Client
Web
Server
SEQ=1000
SEQ=2000
SEQ=3000
ACK=4000
ACK=2000
SEQ=2000
ch05.fm Page 221 Monday, March 20, 2000 5:06 PM