Presentation is loading. Please wait.

Presentation is loading. Please wait.

IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 3: Transport.

Similar presentations


Presentation on theme: "IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 3: Transport."— Presentation transcript:

1 IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 3: Transport Layer Part 2 : Transmission Control Protocol (TCP)

2 Transport Layer Protocol - TCP TCP Connection Management TCP Error Control TCP Flow & Congestion Control Overview 2 TCP Segment Structure & Security

3 Learning Outcomes 1 Explain the functions of TCP and its connection management scheme 2 Describe the three way handshaking process 3 Differentiate between error control, flow control and congestion control 4 Describe the flow and congestion control in TCP and the slow start mechanism 5 Describe the different fields in TCP packets and explain their roles 6 Describe how to secure TCP connections 3

4 Transport Layer Protocol - TCP TCP Connection Management TCP Error Control TCP Flow & Congestion Control Overview 4 TCP Segment Structure & Security

5  Reliable, in-order delivery: Transport Control Protocol (TCP)  Unreliable, unordered delivery: User Datagram Protocol (UDP)  Services not available:  Delay guarantees  Bandwidth guarantees Recap: Transport-Layer Services in The Internet Transport Layer Protocols - TCP application transport network data link physical logical end-end transport application transport network data link physical 5

6 TCP VS. UDP Functions UDP: fragmentation and reassembly, Multiplexing/ Demultiplexing, error-detection using checksum TCP: All UDP functionalities + reliable data transfer (connection management, error-control, flow control, congestion control) Transport Layer Protocols - TCP 6

7  TCP creates reliable service on top of unreliable channel  Point-to-point:  One sender, one receiver  Reliable, in-order byte stream  Error control  Flow control  Congestion control TCP: Overview RFCs: 793, 1323, 258179313232581  Full duplex data:  Bi-directional data flow in same connection  Connection-oriented:  Handshaking (exchange of control messages), initiate sender, receiver state before data exchange  Send & receive buffers Transport Layer Protocols - TCP 7

8 Transport Layer Protocol - TCP TCP Connection Management TCP Error Control TCP Flow & Congestion Control Overview 8 TCP Segment Structure & Security

9 TCP Connection Management  TCP sender, receiver establish “connection” before exchanging data segments  Initialize TCP variables:  Seq. #s  Buffers, flow control info (e.g. Rcvwindow)  Client: connection initiator  Server: contacted by client TCP Connection Management 9

10 A. Three way handshake: Step 1: client host initiates by sending TCP SYN segment to server  specifies initial seq #  no data Step 2: server host receives SYN, replies with SYNACK segment  server allocates buffers  specifies server initial seq. # Step 3: client receives SYNACK, replies with ACK segment, which may contain data TCP Connection Management (cont) TCP Connection Management client SYN server SYNACK ACK Initiate Specify seq# Specify seq # Allocates Buffer 10

11 B. Closing a connection: Client closes socket: Step 1: client end system sends TCP FIN control segment to server Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN. Step 3: client receives FIN, replies with ACK, Enters “timed wait” Step 4: server, receives ACK. Connection closed. TCP Connection Management (cont) TCP Connection Management client FIN server ACK FIN closing timed wait closed 11

12 Transport Layer Protocol - TCP TCP Connection Management TCP Error Control TCP Flow & Congestion Control Overview 12 TCP Segment Structure & Security

13 TCP Reliable Data Transfer  Aim: no bit will be received corrupted and no packet will be lost  Approach: 1. Reactive: resend lost or corrupted packet (error control ) 2. Proactive: Prevent packet loss at the receiver buffer (flow control) and at the router buffers (congestion control) TCP Error Control 13

14 Error-Control Aim: no bit will be corrupted and no packet will be lost Why we need Error-Control?  Underlying channel may flip bits in packets (bit-error). Network layer does not provide a guaranteed service.  Packets may be lost if routed to a wrong address or if dropped because of congestion Q. How to provide a reliable transmission between end users? TCP Error Control 14

15 Error Control Solution  Procedure o A method for detecting bit errors o A way for detecting lost packets o A feedback from the receiver o Retransmission of lost or corrupted packets  A mechanism that is based on retransmission when detecting an error is called ARQ: Automatic Repeat reQuest TCP Error Control 15

16 ARQ: Automatic Repeat reQuest  Bit-error detection: e.g. checksum  Packet-loss detection: sequence numbers  Receiver feedback: acknowledgement (ACK) or negative ack. (NAK)  Retransmission:  stop-and-wait; or  pipelined protocols using sliding window (Taught previously in Networks_1, please refer to networks_1 slides for more details) TCP Error Control - ARQ 16

17  TCP creates reliable service on top of IP’s unreliable service  Pipelined segments  Cumulative acks  Single retransmission timer  Retransmissions triggered by:  Timeout events  Duplicate acks (fast retransmit) TCP Error Control lost ACK scenario Host B Host A Seq=92, 8 bytes of data ACK=100 Seq=92, 8 bytes of data X timeout ACK=100 17

18 TCP Error Control – Retransmission Scenarios TCP Error Control premature timeout Host B Host A Seq=92, 8 bytes of data ACK=100 Seq=92, 8 bytes of data timeout ACK=120 Seq=100, 20 bytes of data ACK=120 SendBase=100 SendBase=120 SendBase=92 X cumulative ACK Host B Host A Seq=92, 8 bytes of data ACK=100 Seq=120, 15 bytes of data timeout Seq=100, 20 bytes of data ACK=120 18

19  Time-out period often relatively long:  Long delay before resending lost packet  Detect lost segments via duplicate acks.  Sender often sends many segments back-to-back  If segment is lost, there will likely be many duplicate acks. TCP Fast Retransmit TCP Error Control – Fast Retransmit If sender receives 3 acks for same data (+original) (“Triple duplicate acks”), resend unacked segment with smallest seq #  Likely that unacked segment lost, so don’t wait for timeout TCP fast retransmit 19

20 TCP Error Control – Fast Retransmit TCP Fast Retransmit X fast retransmit after sender receipt of triple duplicate ACK Host B Host A Seq=92, 8 bytes of data ACK=100 timeout ACK=100 Seq=100, 20 bytes of data Seq=120, 10 bytes of data 20

21 Transport Layer Protocol - TCP TCP Connection Management TCP Error Control TCP Flow & Congestion Control Overview 21 TCP Segment Structure & Security

22  Prevent packet loss at receiver buffer  Sender won’t overflow receiver’s buffer by transmitting too much, too fast  Speed-matching service: matching the send rate to the receiving app’s drain rate  Approach: control number of sent packet (Sender window) based upon the receiver buffer TCP Flow Control TCP Flow & Congestion Control - Flow Control receiver side of TCP connection has a receive buffer: app process may be slow at reading from buffer 22

23  Receiver send the spare buffer-size to sender  Receiver advertises spare room by including value of RcvWindow in segments  Spare room in buffer = RcvWindow  Sender limits unACKed data to RcvWindow  Guarantees receiver buffer doesn’t overflow TCP Flow Control: How It Works? TCP Flow & Congestion Control - Flow Control 23

24  The sender window size is controlled by the receiver window (the number of empty bytes in the receiver buffer)  Closing the sender window – if the receiver buffer is totally full; sender should stop Flow Control: Sender Window Size Expanding the sender window Shrinking the sender window TCP Flow & Congestion Control - Flow Control 24

25 Congestion Control Congestion:  Informally: “too many sources sending too much data too fast for network to handle”  Consequences:  Lost packets (buffer overflow at routers)  Long delays (queueing in router buffers)  Two approaches: 1.end-to-end 2.network-assisted congestion control  Different from flow control! TCP Flow & Congestion Control - Congestion Control 25

26 TCP Congestion Control End- to-end congestion control:  No explicit feedback from network  Congestion inferred from end-system observed by loss, delay,..  Basic idea: ask sender to slow down (or stop altogether) when there is congestion Procedure  Sender notes the receivers advertised window  AND a second window is defined, the Congestion Window  The sender can send up to the lowest of the two  Sender alters the Congestion Window according to the way the network is currently performing  The Congestion Window will keep increasing until segments timeout and then start reducing TCP Flow & Congestion Control - Congestion Control 26

27  When connection begins, increase rate exponentially until first loss event:  Initially cwnd = 1 MSS (maximum segment size)  Double cwnd every RTT  Done by incrementing cwnd for every ACK received  Summary: initial rate is slow but ramps up exponentially fast TCP Slow Start Mechanism Host A one segment RTT Host B time two segments four segments TCP Flow & Congestion Control - Slow Start 27

28 Transport Layer Protocol - TCP TCP Connection Management TCP Error Control TCP Flow & Congestion Control Overview 28 TCP Segment Structure & Security

29 TCP Segment Structure 29

30 Securing TCP TCP & UDP  No encryption  Clear text passwords sent into socket traverse Internet in clear text SSL  Provides encrypted TCP connection  Data integrity  End-point authentication SSL is at application layer  Applications use SSL libraries, which “talk” to TCP SSL socket API  Clear text passwords sent into socket traverse Internet encrypted TCP Segment Structure & Security 30

31 Conclusion TCP service:  Connection-oriented: setup required between client and server processes  Error control: between sending and receiving process  Flow control: sender won’t overwhelm receiver  Congestion control: throttle sender when network overloaded  Does not provide: timing, minimum bandwidth guarantees UDP service:  Unreliable data transfer between sending and receiving processes  Does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee 31

32 References  Computer Networking: A Top-Down Approach Featuring the Internet by James Kurose and Keith Ross, Addison Wesley, 2012 (chapter 3 )Computer Networking  Transmission Control Protocol (RFC793) Transmission Control Protocol (RFC793)  TCP Extensions for High Performance (RFC1323) TCP Extensions for High Performance (RFC1323)  TCP Congestion Control (RFC2581) TCP Congestion Control (RFC2581) 32


Download ppt "IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 3: Transport."

Similar presentations


Ads by Google