1 / 32

Understanding TCP Connection Management & Error Control

Learn about TCP functions, connection management, error, flow, and congestion control. Explore TCP segment structure, security, and how to secure TCP connections.

hwiner
Download Presentation

Understanding TCP Connection Management & Error Control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

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

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

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

  6. Transport Layer Protocols - TCP 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)

  7. Transport Layer Protocols - TCP TCP: Overview RFCs: 793, 1323, 2581 • 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 • 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

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

  9. TCP Connection Management 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

  10. TCP Connection Management client server Initiate Specify seq# SYN Specify seq # Allocates Buffer SYNACK ACK TCP Connection Management (cont) • 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

  11. TCP Connection Management TCP Connection Management (cont) 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. client server closing FIN ACK closing FIN ACK timed wait closed

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

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

  14. TCP Error Control 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?

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

  16. TCP Error Control - ARQ 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)

  17. TCP Error Control TCP Error Control Host B Host A • 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) Seq=92, 8 bytes of data timeout ACK=100 X Seq=92, 8 bytes of data ACK=100 lost ACK scenario

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

  19. TCP Error Control – Fast Retransmit TCP Fast Retransmit TCP fast retransmit • 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. 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

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

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

  22. TCP Flow & Congestion Control - Flow Control TCP Flow Control • 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 receiver side of TCP connection has a receive buffer: app process may be slow at reading from buffer

  23. TCP Flow & Congestion Control - Flow Control TCP Flow Control: How It Works? • 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

  24. TCP Flow & Congestion Control - Flow Control Flow Control: Sender Window Size Expanding the sender window Shrinking the sender window • 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

  25. TCP Flow & Congestion Control - Congestion Control 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: • end-to-end • network-assisted congestion control • Different from flow control!

  26. TCP Flow & Congestion Control - Congestion Control 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

  27. TCP Flow & Congestion Control - Slow Start TCP Slow Start Mechanism Host B Host A • 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 one segment RTT two segments four segments time

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

  29. TCP Segment Structure & Security TCP Segment Structure

  30. TCP Segment Structure & Security 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

  31. Conclusion 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

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

More Related