Chapter 23
Continued
23.64
Flow Control
• TCP uses a sliding window to handle flow control.
• The window spans a portion of the buffer containing bytes received
from the process.
• The window is opened ,closed , or shrunk.
23.65
Figure 23.22 Sliding window
23.66
Note
A sliding window is used to make
transmission more efficient as well as
to control the flow of data so that the
destination does not become
overwhelmed with data.
TCP sliding windows are byte-oriented.
23.67
Note:
• The size of the window at one end is determined by the lesser of
two values: receiver window (rwnd) or congestion window (cwnd).
The receiver window is the value advertised by the opposite end in
a segment containing acknowledgement.
23.68
Sender buffer
❑ The buffer contains bytes that a host can send before
worrying about acknowledgement from the other host
23.69
Receiver window
❑ The receiver window establishes how many bytes the
receiver can store
23.70
Sender buffer and sender window
❑ We have flow control if the sender creates a window –the
sender window- with a size less than or equal to the size
of the receiver window
23.71
Sliding the sender window
❑ Messages from the receiver change the position of the
sender window.
23.72
Expanding the receiver window
❑ If the receiving process consumes data faster than it
receives, the size of the receiver window expands
23.73
Shrinking the receiver window
❑ If the receiving process consumes data more slowly than
it receives data, the size of the receiver window
decreases
23.74
Example 23.4
What is the value of the receiver window (rwnd) for host
A if the receiver, host B, has a buffer size of 5000 bytes
and 1000 bytes of received and unprocessed data?
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
receive only 4000 bytes of data before overflowing its
buffer. Host B advertises this value in its next segment to
A.
23.75
Example 23.5
What is the size of the window for host A if the value of
rwnd is 3000 bytes and the value of cwnd is 3500 bytes?
Solution
The size of the window is the smaller of rwnd and cwnd,
which is 3000 bytes.
23.76
Example 23.6
Figure 23.23 (next slide) shows an unrealistic example of
a sliding window. The sender has sent bytes up to 202. We
assume that cwnd is 20 (in reality this value is thousands
of bytes). The receiver has sent an acknowledgment
number of 200 with an rwnd of 9 bytes (in reality this
value is thousands of bytes). The size of the sender
window is the minimum of rwnd and cwnd, or 9 bytes.
Bytes 200 to 202 are sent, but not acknowledged. Bytes
203 to 208 can be sent without worrying about
acknowledgment. Bytes 209 and above cannot be sent.
23.78
Figure 23.23 Example 23.6
23.79
Note
Some points about TCP sliding windows:
❏ The size of the window is the lesser of rwnd and
cwnd.
❏ The source does not have to send a full window’s
worth of data.
❏ The window can be opened or closed by the
receiver, but should not be shrunk.
❏ The destination can send an acknowledgment at
any time as long as it does not result in a shrinking
window.
❏ The receiver can temporarily shut down the
window; the sender, however, can always send a
segment of 1 byte after the window is shut down.
23.80
Error Control
• TCP is a reliable transport layer protocol.
• This means that an application program that delivers a stream of
data to TCP relies on TCP to deliver the entire stream to the
application program on the other end in order, without error, and
without any part lost or duplicated
• Error detection and correction in TCP is achieved through the use of
three simple tools:
checksum,acknowledgement,and time-out
23.81
Checksum
Each segment includes a checksum field which is used to
check for a corrupted segment. If the segment is corrupted ,it
is discarded by the destination TCP and is considered as lost.
Acknowledgement
TCP uses acknowledgements to conform the receipt of data
segments. Control segments that carry no data but consume
a sequence number are also acknowledged.
Note
ACK segments do not consume
sequence numbers and are not
acknowledged.
23.82
Retransmission
The heart of the error control mechanism is the retransmission
of segments. When a segment is corrupted, lost, or delayed, it
is retransmitted.
Note
In modern implementations, a
retransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
23.83
Note that no retransmission occurs of segments that do not
consume sequence numbers. In particular, there is no
transmission for an ACK segment.
Note
No retransmission timer is set for an
ACK segment.
23.84
Out-of-order segments:
Note
Data may arrive out of order and be
temporarily stored by the receiving TCP,
but TCP guarantees that no out-of-order
segment is delivered to the process.
23.85
Key Terms
• ACK —A TCP flag that acknowledges a TCP packet with SYN-
ACK flags set.
• connection-oriented —A method of transferring data over a
network that requires a session connection before data is sent.
With TCP/IP, this step is accomplished by sending a SYN packet.
• connectionless — With a connectionless protocol, no session
connection is required before data is transmitted. UDP and IP
are examples of connectionless protocols.
• initial sequence number (ISN) —A number that keeps track of
what packets a node has received.
• Internet Assigned Numbers Authority (IANA) — The
organization responsible for assigning IP addresses.
23.86
Key Terms
• Internet Control Message Protocol (ICMP) —The protocol used to
send informational messages and test network connectivity.
• port —The logical component of a connection that identifies the
service running on a network device. For example, port 110 is the
POP3 mail service.
• protocol —A language used to transmit data across a network
infrastructure.
23.87
Key Terms
• session hijacking—An attack on a network that requires guessing
ISNs. See also initial sequence number (ISN).
• SYN —A TCP flag that signifies the beginning of a session.
• SYN-ACK —A reply to a SYN packet sent by a host.
23.88
Key Terms
• TCP flag —The six flags in a TCP header are switches that can be set
to on or off to indicate the status of a port or service.
• three-way handshake —The method the transport layer uses to
create a connection-oriented session.
23.89
Key Terms
• Transmission Control Protocol/Internet Protocol (TCP/IP) —The main
protocol used to connect computers over the Internet.
• User Datagram Protocol (UDP) —A fast, unreliable transport layer
protocol that is connectionless.
23.90