Presentation is loading. Please wait.

Presentation is loading. Please wait.

NET0183 Networks and Communications Lecture 28 TCP: a transport layer protocol... the story continues... Sagan halda áfram 8/25/20091 NET0183 Networks.

Similar presentations


Presentation on theme: "NET0183 Networks and Communications Lecture 28 TCP: a transport layer protocol... the story continues... Sagan halda áfram 8/25/20091 NET0183 Networks."— Presentation transcript:

1 NET0183 Networks and Communications Lecture 28 TCP: a transport layer protocol... the story continues... Sagan halda áfram 8/25/20091 NET0183 Networks and Communications by Dr Andy Brooks Lecture powerpoints from the recommended textbook are by Lami Kaya, Lecture powerpoints are © 2009 Pearson Education Inc. Their content has sometimes been edited by Andy Brooks. transport layer protocol/samskiptareglur flutningslags

2 8/25/2009 NET0183 Networks and Communications by Dr Andy Brooks 2 The recommended textbook is Computer Networks and Internets by Douglas E. Comer (for additional discounts and offers)

3 The port numbers identify the applications. Window is the number of bytes (beyond the sequence number in the acknowledgement field) that the receiver is currently willing to receive. If the ACK flag (A) is set, the value of Acknowledgement Number is the next sequence number that the receiver is expecting (thus acknowledging receipt of all prior bytes). The Sequence Number is the sequence number of the first byte of data in the segment. 3 NET0183 Networks and Communications by Dr Andy Brooks 8/25/2009

4 Sequence number (32 bits) – has a dual role: If the SYN flag is set, then this is the initial sequence number. The sequence number of the actual first data byte (and the acknowledged number in the corresponding ACK) will then be this sequence number plus 1. If the SYN flag is clear, then this is the accumulated sequence number of the first data byte of this packet for the current session. 8/25/2009 NET0183 Networks and Communications by Dr Andy Brooks 4 March 23, 2010

5 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP's Three-Way Handshake To establish or terminate connections reliably, TCP uses a 3-way handshake in which 3 messages are exchanged. During the 3-way handshake to start a connection, each side sends a control message that specifies an initial buffer size (for flow control) and a sequence number. TCP's 3-way exchange ensures unambiguous agreement. –despite packet loss, duplication, delay, and replay events The handshake insures that TCP will not open or close a connection until both ends have agreed.

6 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP's Three-Way Handshake The term synchronization segment or SYN segment is used to describe the control messages used in a 3-way handshake to create a connection. The term finish segment or FIN segment is used to describe control messages used in a 3-way handshake to close a connection. Figure 26.8 illustrates the 3-way handshake to create a connection. A key aspect of the 3-way handshake is the selection of sequence numbers. –TCP requires each end to generate a random 32-bit sequence number that becomes the initial sequence number for data sent.

7 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP's Three-Way Handshake Connection Establishment Figure 26.8 The 3-way handshake used to create a TCP connection. SYN bit on, ACK bit off SYN bit on, ACK bit on ACK bit on

8 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP's Three-Way Handshake If an application attempts to establish a new TCP connection after a computer reboots, TCP chooses a new random number. The probability of selecting a random value that matches the sequence used on a previous connection is very low. So TCP avoids replay problems: –The sequence numbers on the new connection will differ from the sequence numbers used on the old connection. –Delayed packets from the old connection are detected and rejected. To close a connection, the 3-way handshake uses FIN segments. –An ACK is sent in each direction along with a FIN to guarantee that all data has arrived before the connection is terminated. Figure 26.9 illustrates the exchange.

9 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP's Three-Way Handshake Connection Termination Figure 26.9 The 3-way handshake used to close a connection.

10 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP Congestion Control Retransmission can exacerbate congestion by injecting additional copies of a packet. To help avoid congestion collapse, TCP uses changes in delay as a measure of congestion, and it responds to congestion by reducing the rate at which it retransmits data. –The timeout is made bigger. (The length of time the retransmission timer is set for.)

11 The retransmission timeout (RT0) NET0183 Networks and Communications by Dr Andy Brooks 8/25/2009 “In addition, senders employ a retransmission timeout (RTO) that is based on the estimated round-trip time (or RTT) between the sender and receiver, as well as the variance in this round trip time. The behavior of this timer is specified in RFC There are subtleties in the estimation of RTT. For example, senders must be careful when calculating RTT samples for retransmitted packets; typically they use Karn's Algorithm or TCP timestamps (see RFC 1323). These individual RTT samples are then averaged over time to create a Smoothed Round Trip Time (SRTT) using Jacobson's algorithm. This SRTT value is what is finally used as the round-trip time estimate.”round-trip time RFC 2988Karn's AlgorithmRFC 1323Jacobson “Enhancing TCP to reliably handle loss, minimize errors, manage congestion and go fast in very high-speed environments are ongoing areas of research and standards development. As a result, there are a number of TCP congestion avoidance algorithm variations.”TCP congestion avoidance algorithm

12 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP Congestion Control A sending TCP can effectively reduce the data rate by temporarily reducing the window. In the extreme case where loss occurs, TCP temporarily reduces the window to one-half of its current value. (simplified story) –A loss is assumed if no ACK arrives within the timeout (the length of time the retransmission timer is set for).

13 Explanation of TCP slow start 13 NET0183 Networks and Communications by Dr Andy Brooks 8/25/2009 “The above diagram and description is based on the Message Segment Size (MSS) of 1 KB, no datagrams or ACKs are lost, and the send window size (Ws) is maximum (64KB).”

14 Explanation of TCP slow start TCP does not immediately send data to fill up a receiver´s window. TCP starts by sending one segment. – W c (the congestion window) equals 1. If an ACK arrives before the retranmission timer is set to expire, W c is increased by 1. This “doubling” continues until the slow start threshold (SST) is reached. W c then increases by 1 segment for each set of ACKs that are received, rather than increase by 1 for each ACK received. Eventually data throughput reaches the maximum allowed by the receiver´s window. 8/25/2009 NET0183 Networks and Communications by Dr Andy Brooks 14

15 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP Segment Format TCP uses a single format for all messages. TCP uses the term segment to refer to a message. Figure illustrates the TCP segment format. A TCP connection contains two streams of data, one flowing in each direction.

16 © 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved TCP Segment Format Figure The TCP segment format used for both data and control messages.


Download ppt "NET0183 Networks and Communications Lecture 28 TCP: a transport layer protocol... the story continues... Sagan halda áfram 8/25/20091 NET0183 Networks."

Similar presentations


Ads by Google