Download presentation
Presentation is loading. Please wait.
Published byEdgar Dicker Modified over 9 years ago
1
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas E. Comer Lecture PowerPoints By Lami Kaya, LKaya@ieee.org
2
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.2 Chapter 25 TCP: Reliable Transport Service
3
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.3 Topics Covered 25.1 Introduction 25.2 The Need For Reliable Transport 25.3 The Transmission Control Protocol 25.4 The Service TCP Provides To Applications 25.5 End-To-End Service And Datagrams 25.6 Achieving Reliability 25.7 Packet Loss And Retransmission 25.8 Adaptive Retransmission 25.9 Comparison Of Retransmission Times 25.10 Buffers, Flow Control, And Windows 25.11 Three-Way Handshake 25.12 Congestion Control 25.13 TCP Segment Format
4
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.4 25.1 Introduction This chapter examines TCP, the major transport protocol in TCP/IP explains how the protocol provides reliable delivery TCP uses the unreliable datagram service offered by IP –But it provides a reliable data delivery service to applications TCP must compensate for loss or delay in an internet to provide efficient data transfer –without overloading the underlying NWs and routers
5
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.5 25.2 The Need For Reliable Transport Programmers would like conventional reliability techniques –when creating applications for the Internet SW in the internet must provide the same semantics as a conventional computer system SW must guarantee prompt and reliable communication –data must be delivered in exactly the same order that the data was sent –and there must be no loss or duplication
6
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.6 25.3 The Transmission Control Protocol Reliability is the responsibility of a transport protocol Applications interact with a transport service to send and receive data In the TCP/IP suite, the Transmission Control Protocol (TCP) provides reliable transport service
7
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.7 25.4 The Service TCP Provides To Applications TCP has seven major features: Connection Orientation Point-To-Point Communication –Each TCP connection has exactly two endpoints Complete Reliability –Data will be delivered exactly as it was sent –No data missing or out of order Full Duplex Communication –TCP can buffer outgoing and incoming data in both directions
8
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.8 25.4 The Service TCP Provides To Applications (cont) Stream Interface –an application sends a continuous sequence of octets –TCP does not provide a notion of records Reliable Connection Startup –TCP requires that when two applications create a connection, both must agree to the new connection, avoiding duplicates Graceful Connection Shutdown –TCP guarantees to deliver all the data reliably before closing the connection
9
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.9 25.5 End-To-End Service And Datagrams TCP is called an end-to-end protocol –because it provides a connection directly from an application on one computer to an application on a remote computer The connections provided by TCP –called “virtual connections" because they are achieved in SW The concept is shown in Fig.25.1 The underlying internet system does not provide HW or SW support for connections Each TCP message is encapsulated in an IP datagram
10
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.10
11
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.11 25.6 Achieving Reliability The major problems are: –unreliable delivery by the underlying communication system –and computer reboot Any message can be lost, duplicated, delayed, or delivered out of order –Messages must be unambiguous, or the protocol will accept duplicate messages from the old connection Two application programs establish a connection and then one of the computers is rebooted? –the computer that reboots has no knowledge of the connection, –the computer that did not reboot considers the connection valid
12
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.12 25.7 Packet Loss And Retransmission How does TCP achieve reliability? Most important techniques is using retransmission (RET) –When TCP receives data it sends an acknowledgement (ACK) –Whenever it sends data TCP starts a timer –If the timer expires before an ACK arrives the sender RETs the data How long should TCP wait before a RET? –ACKs on a LAN are expected to arrive within a few milliseconds –Waiting too long leaves the NW idle, effect throughput –RET on a long-distance satellite connection is not suitable TCP faces a more difficult challenge –congestion may causes delays along a given path to change rapidly
13
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.13 Fig. 25.2 Example of retransmissions
14
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.14 25.8 Adaptive Retransmission (1) TCP monitors current delay on each connection –adapts the RET timer for changing conditions How can TCP monitor internet delays? –TCP cannot know the exact delays for an internet at all times –Instead, TCP estimates round-trip delay for each connection –As it sends data packets and receives ACKs, TCP generates a sequence of round-trip estimates and uses a statistical function to produce a weighted average –In addition to a weighted average TCP keeps an estimate of the variance
15
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.15 25.8 Adaptive Retransmission (2) TCP adaptive RET works well: –Using the variance helps TCP react quickly when delay increases following a burst of packets –Using a weighted average helps TCP reset the RET timer if the delay returns to a lower value after a temporary burst –When the delay remains constant TCP adjusts the RET timeout to a value that is slightly longer than the mean round-trip delay –When delays start to vary TCP adjusts the RET timeout to a value greater than the mean to accommodate peaks
16
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.16 25.9 Comparison Of Retransmission Times How adaptive RET helps TCP maximize throughput? –consider a case of packet loss on two connections that have different round-trip delays Figure 25.3 illustrates traffic on two such connections. As the figure shows, TCP sets the RET timeout to be slightly longer than the mean round-trip delay –If the delay is large TCP uses a large retransmission timeout –If the delay is small TCP uses a small timeout. The goal is to wait long enough to determine that a packet was lost –without waiting longer than necessary
17
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.17
18
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.18 25.10 Buffers, Flow Control, And Windows (1) Each end allocates a buffer –and sends the size of the buffer to the other end As data arrives, the receiver sends ACKs –which also specify the remaining buffer size The amount of buffer space available at any time –called the “window” A notification that specifies the size –called a “window advertisement” (WA)
19
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.19 25.10 Buffers, Flow Control, And Windows (2) A receiver sends a WA with each ACK –If the receiver can read the data as quickly as it arrives a receiver will send a positive WA along with each ACK –If the sender operates faster than the receiver incoming data will eventually fill the receiver's buffer causing the receiver to advertise a zero window –A sender that receives a zero WA must stop sending until the receiver again advertises a positive window size Figure 25.4 illustrates window advertisements
20
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.20
21
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.21 25.11 Three-Way Handshake (1) To guarantee that connections are established or terminated reliably –TCP uses 3-way handshake, in which three messages are exchanged 3-way exchange is necessary and sufficient to ensure unambiguous agreement –despite packet loss, duplication, and delay TCP uses the term “synchronization” (SYN) segment –to describe messages in a 3-way handshake used to create a connection The term “finish” (FIN) segment –to describe messages in a 3-way handshake used to close a connection Figure 25.5 illustrates the 3-way handshake for a closure
22
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.22
23
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.23 25.11 Three-Way Handshake (2) Like other messages –TCP retransmits lost SYN or FIN segments Handshake guarantees that TCP will not open or close a connection until both ends have interacted Each end should generate a random sequence number If a new TCP connection after a reboot –TCP chooses a new random number –Each end of a connection begins with a new sequence number To avoid problems of duplicate or delayed packets
24
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.24 25.12 Congestion Control (1) TCP uses packet loss as a measure of congestion –responds to congestion by reducing the rate at which it RET data TCP does not compute an exact transmission rate –Bases its transmission rate on buffers –Therefore, the receiver advertises a window size TCP imposes a restriction on the window size Congestion control takes over when a message is lost Instead of RET enough data to fill the receiver's buffer – TCP begins by sending a single message If the ACK arrives –TCP doubles the amount of data being sent –and sends two additional messages
25
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.25 25.12 Congestion Control (2) If ACK arrive for those two –TCP sends four more, and so on The exponential increase continues –until TCP is sending half of the receiver's WA, at which time TCP slows down the rate –Increase the window size linearly (as long as no congestion) Congestion control responds well to increased traffic By backing-off quickly –TCP is able to alleviate congestion TCP avoids adding RETs to a congested internet If all TCPs follow the standard –the congestion control scheme means that all senders back-off when congestion occurs, and thereby avoid congestion collapse
26
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.26 25.13 TCP Segment Format TCP uses a single format for all messages, –including messages that carry data, –those that carry ACKs, –and messages that are part of the 3-way handshake used to create or terminate a connection TCP uses the term “segment” to refer to a “message” Figure 25.6 illustrates the TCP segment format
27
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.27
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.