1 Transport Layer - UDP & TCP Protocols "I cannot teach anybody anything, I can only make them think.” - Socrates.

Slides:



Advertisements
Similar presentations
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
Advertisements

Prentice HallHigh Performance TCP/IP Networking, Hassan-Jain Chapter 2 TCP/IP Fundamentals.
Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 5 Transport Layer TCP/IP Protocols.
CCNA – Network Fundamentals
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public ITE PC v4.0 Chapter 1 1 OSI Transport Layer Network Fundamentals – Chapter 4.
Transmission Control Protocol (TCP)
Intermediate TCP/IP TCP Operation.
Guide to TCP/IP, Third Edition
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
CSE551: Computer Network Review r Network Layers r TCP/UDP r IP.
CS3505 The Internet and Info Hiway transport layer protocols : TCP/UDP.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Chapter 7 – Transport Layer Protocols
TELE202 Lecture 14 TCP/UDP (2) 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (1) »Source: chapter 17 ¥This Lecture »TCP/UDP (2) »Source: chapter.
Computer Networks 2 Lecture 2 TCP – I - Transport Protocols: TCP Segments, Flow control and Connection Setup.
UNIT 07 Process – to – Process Delivery: UDP,TCP and SCTP
Transport Layer 3-1 outline r TCP m segment structure m reliable data transfer m flow control m congestion control.
Transport Layer 3-1 Fast Retransmit r time-out period often relatively long: m long delay before resending lost packet r detect lost segments via duplicate.
Transport Layer 3-1 Outline r TCP m Congestion control m Flow control.
Computer Networks Transport Layer. Topics F Introduction  F Connection Issues F TCP.
Department of Electronic Engineering City University of Hong Kong EE3900 Computer Networks Transport Protocols Slide 1 Transport Protocols.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
Transport Layer TCP and UDP IS250 Spring 2010
Process-to-Process Delivery:
Gursharan Singh Tatla Transport Layer 16-May
What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best.
Process-to-Process Delivery:
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
1 Chapter Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
1 Transport Layer Computer Networks. 2 Where are we?
Introduction to Networks CS587x Lecture 1 Department of Computer Science Iowa State University.
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 All.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
University of the Western Cape Chapter 12: The Transport Layer.
ECE453 – Introduction to Computer Networks Lecture 14 – Transport Layer (I)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 2.5 Internetworking Chapter 25 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
1 TCP: Reliable Transport Service. 2 Transmission Control Protocol (TCP) Major transport protocol used in Internet Heavily used Completely reliable transfer.
23.1 Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CSE679: Computer Network Review r Review of the uncounted quiz r Computer network review.
Copyright © Lopamudra Roychoudhuri
Institute of Technology Sligo - Dept of Computing Chapter 12 The Transport Layer.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
Computer Networks23-1 PART 5 Transport Layer. Computer Networks23-2 Position of Transport Layer Responsible for the delivery of a message from one process.
ECE 4110 – Internetwork Programming
Guide to TCP/IP Fourth Edition
1 Computer Communication & Networks Lecture 23 & 24 Transport Layer: UDP and TCP Waleed Ejaz
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy.
Computer Networks 1000-Transport layer, TCP Gergely Windisch v spring.
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
The Transport Layer Implementation Services Functions Protocols
Introduction to Networks
Transport Layer.
Process-to-Process Delivery, TCP and UDP protocols
Process-to-Process Delivery
PART 5 Transport Layer Computer Networks.
TCP Transport layer Er. Vikram Dhiman LPU.
Magda El Zarki Professor, ICS UC, Irvine
Transport Layer Unit 5.
Process-to-Process Delivery:
PART V Transport Layer.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Computer Networks Protocols
Transport Layer 9/22/2019.
Presentation transcript:

1 Transport Layer - UDP & TCP Protocols "I cannot teach anybody anything, I can only make them think.” - Socrates

2 Transport Layer - UDP & TCP Protocols  Connectionless & connection-oriented protocols  User Datagram Protocol (UDP)  UDP Datagram Format  Transmission Control Protocol (TCP)  TCP Features and Segment Format  Flow Control Mechanism and Congestion Control  Sections 11.6, 12.5, 12.9, 12.10, will not be discussed

3 Transport Protocols Internet protocol architecture Application Services (FTP, Telnet, SMTP, …) Transport Services (TCP, UDP, SCTP) Connectionless Packet Delivery Service (IP) OSI Layers Layer 4 - Transport Layer 3 - Network TCP - Transmission Control Protocol UDP - User Datagram Protocol SCTP - Stream Control Transmission Protocol

4 Encapsulating TCP/UDP in IP Datagrams Layer 2 Data Link HeaderData Link DataFCS IP HeaderIP Data Layer 3 TCP/UDP Header Application Data Layer 4 FCS: Frame Check Sequence (for error checking)

5 Connection-oriented & Connectionless protocols & services Why are they called connection-oriented and connectionless? What are their distinct characteristics? Why these different protocols are needed? Examples of connection-oriented and connectionless transport protocols

6 Connection-oriented protocols Three phases: –Connection setup –Data transfer –Connection release A connection need to be setup between end points prior to the data transfer Data delivery, integrity and sequencing are guaranteed Connection is released after the data transfer Better suited for applications that require guaranteed delivery, but can tolerate some delays E.g. TCP (Transmission Control Protocol)

7 Connectionless protocols No connection setup necessary prior to data transfer Each datagram is routed independently and can take different paths through the network; therefore datagrams could arrive at the destination out of sequence Best-effort delivery (no guaranteed delivery) No connection release phase after data transfer Less overhead and therefore fast (less delay) Better suited for applications needing low delay but can tolerate some data losses (E.g. voice applications) Examples: IP and UDP (User Datagram Protocol)

8 Transport Protocols How can a connection-oriented transport protocol (like TCP) provide guaranteed data delivery, integrity and sequencing when they have to use connectionless IP at the network layer?

9 Transport Protocols The connection-oriented transport protocol (like TCP) has to implement additional procedures at the transport layer for ensuring data delivery, integrity and sequencing This is at the cost of more overhead and processing time (thus slower than connectionless protocols)

10 User Datagram Protocol (UDP) - RFC 768 Provides a minimal, simple, and best-effort transport layer protocol, as some applications do not require the robustness of TCP Provides a connection-less service to applications –Reliable data delivery or delivery of data in the correct sequence are not guaranteed Faster and more efficient than TCP Examples of applications using UDP: –DNS (Domain Name System) –SNMP (Simple Network Management Protocol)

11 UDP Datagram Format Source PortDestination Port Checksum Data Length ………. Bits Source & destination ports: identifies the source and destination processes/applications Length: length of the UDP datagram (including header and data) in bytes Checksum: Covers the UDP header and data; Optional (with value set to 0, if not computed)

12 Port Numbers Defined in three ranges: Well-known ports ( ) Defined in the “Assigned Numbers” RFC Assigned to core services that systems offer E.g. Telnet - Port 23, FTP Control data - Port 21 Registered ports ( ) Assigned to industry applications and processes E.g. Microsoft SQL Server process - Port 1433 Dynamic (or, ephemeral) ports ( ) Can use as temporary ports without being assigned

13 TCP Features Defined in RFC 793 (RFC 1122 contains some corrections) Various enhancements proposed in subsequent RFCs Connection oriented protocol (needs specific connection set up & release) Provides end-to-end (i.e., between hosts) reliable, sequenced delivery of data segments –Checksum covering header & payload –End to end acknowledgements –Retransmissions Flow control using a sliding window mechanism Congestion control (detection & avoidance)

14 Ports, Connections & End points A “port number” identifies an application process An “end point” is identified by IP Address & Port (called a TCP socket) A “connection” is identified by two end points (two sockets) App A TCP IP TCP IP App A App B TCP connection A TCP connection B Ports

15 TCP Segment Format Source PortDestination Port Sequence Number Ack Number Checksum Data Urgent Pointer PaddingOptions (if any) ………. Code bitsHLenResvdWindow Size Bits The basic unit of data transferred by TCP to IP is a “segment”

16 TCP Segment fields... Source & destination ports: identifies the source and destination processes or applications Ack number: indicates the sequence number of the next expected data octet by the receiver. –Acknowledges receipt of all data bytes up to byte sequence number = (Ack number - 1) –TCP Acks are cumulative (i.e., one Ack may acknowledge receipt of data in several consecutive segments)

17 TCP Segment fields... Sequence number: indicates the sequence number of the first byte in the segment HLen (or, Data Offset): Number of 32-bit words in the TCP header. The typical value is 5 (20 bytes of header, if Options are not used) Window: indicates the number of bytes the receiver is prepared to accept from the sender (called rwnd). This reflects free buffer space available at the receiver. Checksum: Covers the TCP header and data; Mandatory in TCP.

18 TCP Segment fields... Urgent Pointer: –Used to deliver urgent data to the application at the receiver, ahead of any other received data that are buffered (jumping the queue) –Indicates the position of the last byte of urgent data –Valid only when URG = 1 in the Code (or, Flags) bits Options: –One of the options is Max. Segment Size (MSS). –If used, MSS is indicated only at the connection set up –If not specifically announced, a default segment size of 536 bytes is assumed

19 TCP Code bits URGACKPSHRSTSYNFIN URGUrgent Pointer field is valid ACKAck field is valid PSHThis segment requests a “Push” RSTReset the connection SYNSynchronize the sequence numbers FINNo more data from sender

20 Connection Establishment 3-way handshake Both sides agree on initial sequence numbers Two data streams (one in each direction) are established Host AHost B Send SYN; Seq = x Receive SYN Send SYN; Seq = y Ack = x+1 Receive SYN + ACK Send Ack = y+1 Receive ACK Time

21 Connection Release Each direction is shut down independently Host AHost B Send FIN; Seq = x Receive FIN Send Ack = x+1 Inform application Receive ACK Send Ack = y+1 Receive ACK Time Application closes connection App closes connection Send FIN; Seq = y; Ack = x+1 Receive FIN + ACK Connection half closed...B can still send data... Connection fully closed...

22

23 Data Transfer In a SYN segment, a host may announce the MSS (max. segment size) it expects to receive (default: 536 bytes) In each TCP header, a host indicates how many “bytes” it is ready to accept - “receiver window advertisement (rwnd)”. Sender divides its byte stream into “segments”. Sequence numbers are assigned to each byte. Each TCP segment header carries the Seq # of the first byte in it. When a segment is sent (not to exceed the MSS or the sender’s window size), a “retransmission timer” is started. If an ACK is not received before the timer expiry, the segment is resent.

24 Flow Control Hosts that send and receive TCP data segments can operate at different data rates because of differences in CPU and network bandwidth. A fast sender can overwhelm a slow receiver! TCP implements flow control based on a sliding window mechanism The sender’s window size = min(rwnd, cwnd) cwnd - Congestion Window value is dependent on the current “congestion control” phase of the sending host. cwnd attempts to consider the network congestion in determining the sender’s window size at any given time.

25 TCP’s Sliding Window example... … … … … Receiver’s advertised window (30 bytes) ASent & acked BSent & not acked CCan be sent now, before receiving an ack DCannot be sent until the window moves (i.e., until an ack is received) ABCD

26 Silly Window Syndrome Sending application creating data slowly or the receiving application consuming received data slowly could result in sending of very few number of data bytes in a segment This decreases the efficiency of TCP operation and is called the “Silly Window Syndrome” Eg: If TCP sends segments with only 1 byte of user data, a 41-byte IP packet (with 20 bytes of TCP header + 20 bytes of IP header) will have only have a data delivery efficiency of: (1/41) x > 2.4% (without even considering data link header + trailer overhead)

27 Syndrome created by Sender Sending application may create data slowly (eg: 1 byte at a time) and sending TCP may create segments containing only a single data byte “Nagle’s Algorithm” provides a solution –Sending TCP sends the 1st segment even if it is only 1 byte –After sending the 1st segment, sending TCP accumulates data and waits until, either: Receives an ACK, or Enough data has accumulated to fill a max-size segment

28 Syndrome created by Receiver Receiving application may consume data slowly (eg: 1 byte at a time) and receiver-side TCP may announce a window size of 1 byte (or, a very small window size), resulting in sender creating very small segments Two solutions: Clark’s Solution & Delayed ACKs Clark’s solution: –Send an ACK as soon as data is received, but announce a window size of 0 until, either: there is enough buffer space to accommodate a segment of max size, or half of the buffer is empty

29 Delayed ACKs When a segment is received, don’t send an ACK immediately Receiver waits until there is sufficient amount of free buffer space before sending an ACK One advantage of Delayed ACKs is reduced traffic (as each segment doesn’t need to be ACKed individually) Disadvantage is, delayed ACKs may force the sender to retransmit unacked segments To minimize retransmissions by sender, receiver should not delay an ACK by more than 500 ms.

30 Selective ACKs ( RFC 2018 ) Allows a receiver to inform the sender a list of duplicate segments and lists of out-of-order segments received in the “Options” field Sender can selectively retransmit only the missing segments During connection setup phase, the two TCP hosts agree whether they support this feature using “SACK- permitted” option SACKs improve TCP performance in congested networks or networks with unreliable links

31 Fast Retransmission (RFC 2581) Originally, TCP was designed to discard out-of-order segments by the receiving host. Most implementations today store out-of-order segments until the missing segment arrives. When an out-of-order segment is received with a seq # higher than the expected seq #, receiver immediately sends an ACK, announcing the seq # of the next expected segment. When the sender receives 4 ACKs with the same value (i.e., 3 duplicate ACKs), it retransmits the segment expected by the receiver without waiting for Retransmission Timer expiry.

32 Figure Fast retransmission

33 TCP Congestion Control Congestion in a network happens when the input traffic rate is greater than the traffic processing rate of network nodes for consistently long periods of time To recover from congestion, traffic input rate needs to be reduced by the sending hosts TCP handles congestion using following mechanisms (RFC 2581): –Slow start –Congestion Avoidance –Congestion detection

34 Slow-Start Phase At the beginning of data transfer phase, sending host probes the status of the network to find out whether the network is already congested or not Sender starts with cwnd = 1 or 2 MSS For each acknowledged segment, cwnd is increased by 1 MSS. cwnd is increased in this manner until a threshold (called “ssthresh - slow start threshold”) is reached In most implementations, “ssthresh” is bytes Increase of cwnd in the slow-start phase is exponential until the ssthresh is reached

35 Figure Slow start, exponential increase

36 Congestion Avoidance Phase Congestion Avoidance Phase: –Starts when cwnd in the slow-start phase reaches ssthresh threshold –To slow down the exponential increase of cwnd, each time the “whole window of segments” is acknowledged, cwnd is increased by 1 MSS. –cwnd is increased additively in this manner until congestion is detected

37 Figure Congestion avoidance, additive increase

38 Congestion Detection Phase When a sender has to retransmit a segment, it is considered as a sign of network congestion In most implementations, if the congestion detection is due to: –“Retransmission Timer expiry”, a new slow-start phase is started –“Receipt of 3 duplicate ACKs”, a new congestion avoidance phase is started

39 Figure Congestion example