Module 1 UDP & TCP.

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

© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
CSCI 4550/8556 Computer Networks
Transmission Control Protocol (TCP)
Intermediate TCP/IP TCP Operation.
Guide to TCP/IP, Third Edition
IS333, Ch. 26: TCP Victor Norman Calvin College 1.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
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.
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.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
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?
IP and Errors IP Best Effort Datagrams can be: –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP Lecture 13 November 13, TCP Background Transmission Control Protocol (TCP) TCP provides much of the functionality that IP lacks: reliable service.
University of the Western Cape Chapter 12: The Transport Layer.
SMUCSE 4344 transport layer. SMUCSE 4344 transport layer end-to-end protocols –transport code runs only on endpoint hosts encapsulates network communications.
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.
The Transmission Control Protocol (TCP) Application Services (Telnet, FTP, , WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery.
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
1 TCP: Reliable Transport Service. 2 Transmission Control Protocol (TCP) Major transport protocol used in Internet Heavily used Completely reliable transfer.
Chapter 24 Transport Control Protocol (TCP) Layer 4 protocol Responsible for reliable end-to-end transmission Provides illusion of reliable network to.
Computer Networks23-1 PART 5 Transport Layer. Computer Networks23-2 Position of Transport Layer Responsible for the delivery of a message from one process.
1 End-to-End Protocols User Datagram Protocol (UDP) Transmission Control Protocol(TCP)
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
1 Transmission Control Protocol (TCP) RFC: Introduction The TCP is intended to provide a reliable process-to-process communication service in a.
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
1 Chapter 24 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
The Transport Layer Implementation Services Functions Protocols
Chapter 9: Transport Layer
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
Instructor Materials Chapter 9: Transport Layer
Introduction to Networks
5. End-to-end protocols (part 1)
Transport Layer.
Process-to-Process Delivery, TCP and UDP protocols
TCP.
PART 5 Transport Layer Computer Networks.
Introduction of Transport Protocols
Internet and Intranet Protocols and Applications
TCP - Part I Karim El Defrawy
Transport Layer Unit 5.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Process-to-Process Delivery:
Dr. John P. Abraham Professor UTPA
Dr. John P. Abraham Professor UTPA
PART 5 Transport Layer.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
The Transmission Control Protocol (TCP)
Transport Protocols: TCP Segments, Flow control and Connection Setup
Introduction to Computer Networks
Lecture 21 and 22 5/29/2019.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Transport Layer 9/22/2019.
Presentation transcript:

Module 1 UDP & TCP

Introduction The Internet Protocol (IP) provides “unreliable datagram service” between hosts Transport protocols provide end-to-end delivery between the endpoints of a connection; between processes or programs. The User Datagram Protocol (UDP) provides datagram service. The Transmission Control Protocol (TCP) provides reliable data delivery service.

User Datagram Protocol UDP delivers independent messages, called datagrams between applications or processes on host computers. “Best effort” delivery means datagrams may be lost, delivered out of order, etc. An optional checksum in UDP messages improves the integrity of the data.

User Datagram Protocol The endpoints of a UDP communication are called protocol ports or, more simply, just ports . Each UDP data transmission identifies the internet address and port number of the destination and the source (IP address and port number) of the message. The destination port and the source port may be different.

UDP and TCP/IP Layering Transport protocols are used to provide data delivery services for application protocols. Applications Transmission Control Protocol User Datagram Protocol Internet Protocol Network Interface Hardware

UDP Headers UDP messages have a header that follows the hardware and IP headers: Hardware IP UDP Data The UDP header format is simple: Source and destination port numbers, and message length (in octets) Optional checksum (0 if not used) Source Port Destination Port Message Length Checksum

Selecting UDP Port Numbers Communicating computers must agree on a port number The “server” opens the selected port and waits for incoming messages. The “client” selects a local port and sends a message to the selected “server” port.

Selecting UDP Port Numbers The services provided by many computers use reserved, well-known port numbers: ECHO (usually port 7) DISCARD (usually port 9) TIME (usually port 37) Other services use dynamically assigned port numbers.

UDP Encapsulation Each UDP datagram is encapsulated in an IP datagram for transmission across the Internet Figure 25.3 (below) illustrates the encapsulation

Modes of Interaction and Broadcast Delivery UDP allows four styles of interaction: 1-to-1 1-to-many Many-to-1 Many-to-many An application using UDP has a choice A 1-to-many interaction can be achieved as An application to repeatedly send a message to multiple recipients, UDP allows an application to transmit the message via IP multicast or broadcast For example, local broadcast can be specified by using IP's limited broadcast address, 255.255.255.255

UDP Checksum Computation And The Pseudo-Header UDP checksum software extracts the pseudo-header fields, places them in memory, appends a copy of the UDP message computes a checksum over the entire object.

IPv4 UDP Pseudo-Header Format

IPv6 UDP Pseudo-Header Format

UDP Multiplexing

Transmission Control Protocol (TCP) Transmission Control Protocol (TCP) is the most widely used transport protocol. It provides reliable data delivery by using IP unreliable datagram delivery. It compensates for loss, delay, duplication and similar problems in Internet components. Reliable delivery is the high-level, familiar model used in the construction of applications.

TCP Features Connection oriented: An application requests a connection to a destination and then uses that connection to transfer data. Point-to-point: A TCP connection has two endpoints. Reliable: TCP guarantees the data will be delivered without loss, duplication or transmission errors. Full duplex: The endpoints of a TCP connection can exchange data in both directions simultaneously.

TCP Features Stream interface: An application delivers data to TCP as a continuous stream, with no record boundaries; TCP makes no guarantees that the data will be received in the same units in which it was transmitted. Reliable connection startup: A three-way handshake guarantees reliable, synchronized startup between endpoints. Graceful connection shutdown: TCP guarantees delivery of all data after endpoint shutdown by an application.

Using IP for Data Delivery TCP uses IP for data delivery (like UDP). The endpoints are identified by port numbers (like UDP): This allows multiple connections on each host. The ports may be associated with an application or a process. The TCP port numbers are in a different address space than UDP ports; TCP port 23 is not the same as UDP port 23. IP treats TCP messages like data and does not interpret any contents of the TCP message.

Delivering TCP Messages TCP messages travel in IP datagrams. Internet routers only look at the IP header to forward datagrams. The TCP protocol software at the destination interprets TCP messages.

TCP and Reliable Delivery TCP uses many techniques described earlier to provide reliable delivery. It recovers from: lost packets duplicate packets delayed packets corrupted data transmission speed mismatches congestion system reboots

Lost Packets TCP uses positive acknowledgment with retransmission (PAR) to achieve reliable data delivery. The recipient sends acknowledgment control messages (ACKs) to the sender to report successful receipt of data. The sender sets a timer when data is transmitted; if the timer expires before an acknowledgment arrives, the sender retransmits the data (with a new timer).

TCP Segments and Sequence Numbers An application delivers arbitrarily large chunks of data to TCP as a “stream” of bytes. TCP breaks this data into segments, each of which fits into an IP datagram. Each byte in the original stream is given a sequence number. Each TCP segment identifies the range of sequence numbers of the data bytes included in the segment.

Acknowledgements When a receiver sends a segment containing its own data, it includes the range of sequence numbers of data (from the sender) that it acknowledges. The receiver does not acknowledge individual segments. One ACK can acknowledge many segments.

Setting the Timeout Interval Using inappropriate timeout intervals can cause poor performance: If it’s too long, the sender waits longer than necessary before retransmitting a segment. If it’s too short, the sender generates unnecessary traffic. The timeout interval must be different for each connection and must be set dynamically. Hosts on same LAN should have shorter timeout intervals than hosts 20 hops away. Delivery time across an internet may change over time; timeout intervals must accommodate changes.

Different Round-Trip Delays Timeout and retransmission on two connections may have different round- trip delays. TCP optimizes throughput by using estimates of round-trip delays to compute retransmission timer invervals.

Picking a Value for the Timeout Interval The timeout interval should be based on the estimated round-trip time (RTT) for a segment. The sender doesn’t know the RTT of any segment before transmission. The sender picks a retransmission timeout (RTO) based on previous RTT values. The specific method is called the adaptive retransmission algorithm.

Computation of RTT and RTO A weighted average is used to update the round-trip time. The parameter  controls how much a new RTT value can influence the average;  is typically 7/8. The timeout interval (RTO) is just the new RTT average times another parameter, , which always used to be 2.

Jacobson’s Mean Deviation Algorithm Instead of using a fixed  in RTO computations, most TCP implementations now compute D, a weighted average of the difference between the expected RTT value and the actual value, M.  may be different from the value used in computing the weighted RTT value. Now, RTO is computed as follows. The value 4 has been shown to give good performance (but was originally suggested to be 2).

Measuring Round-Trip Delay (RTT) RTT is measured by observing the difference between the time of transmission and the time of arrival of an acknowledgment. However, acknowledgments carry no information about which packet was acknowledged. Thus, the sender cannot determine whether the acknowledgment is from the original transmission or from a retransmission. Choosing the original transmission overestimates RTT. Choosing the retransmission underestimates RTT.

Karn’s Algorithm How is TCP to choose between the original and a retransmission? The answer: choose neither! Karn's algorithm specifies that the sender ignores RTTs for retransmitted segments. How will the RTT get updated if the internet round trip time increases? Karn's algorithm specifies that RTO values be computed separately from RTT when retransmissions occur. RTO doubles with new segment retransmission until an ACK arrives.

The TCP Sliding Window TCP uses a sliding window for flow control. The receiver specifies the window. This is called window advertisement. It specifies which bytes in the data stream can be sent. It is carried in segment along with an ACK. The sender can transmit any bytes, in any size segment, after the last acknowledged byte, but must stay within window.

A Sliding Window with Acknowledgements

The Silly Window Syndrome Under some circumstances, the sliding window protocol can result in the transmission of many small segments. If the receiver window is full, and the receiving application consumes a few data bytes, the receiver will advertise a small window. The sender will immediately send a small segment to fill the window. This is inefficient in terms of processing time and network bandwidth. Solutions: Have the receiver delay advertising a new window until it is of reasonable size (Clark’s solution). Have the sender delay sending data when the window is small (Nagle’s solution).

Silly Window Syndrome Example Receiver’s buffer is full Application reads one byte  Room for one more byte Header New window size advertised Header New byte arrives Receiver’s buffer is full 1 Byte

The TCP Segment Format Each TCP segment has the folowing header: The same header format is used in both directions. Each segment carries an acknowledgement and possibly data.

Urgent Data When a host decides to interrupt a remote application, the appropriate control information is sent as urgent data in the TCP data stream. The presence of urgent data is indicated by setting the URG bit (in the code bits), and pointing to the end of the urgent data in the segment with the urgent pointer. When urgent data is sent by an application, TCP sends everything it has accumulated (including the urgent data) immediately. When the remote application receives the urgent data (usually with a signal, in UNIX terminology), it stops whatever it was doing to handle the urgent data.

TCP connections are identified by a pair of endpoints TCP Endpoints TCP connections are identified by a pair of endpoints pair of integers (host, port) (18.26.0.36, 1069) and (128.10.2.3, 25)

Passive And Active Opens application program on one end performs a passive open by contacting the local operating system indicating that it will accept an incoming connection for a specific port number.

Passive And Active Opens The application program on the other end can then perform an active open by requesting that a TCP connection be established.

Establishing A TCP Connection

Three-Way Handshake

Three-Way Handshake TCP uses a three-way handshake for reliable connection establishment. Host 1 sends a segment with the SYN bit set (in the code bits) and a random sequence number. Host 2 responds with a segment with SYN bit set, acknowledgment of Host 1’s sequence number, and a random sequence number of its own. Host 1 responds with an acknowledgment of Host 2’s sequence number.

Three-Way Handshake TCP will retransmit lost segments. Random sequence numbers ensure synchronization between endpoints. The same type of three-way handshake is used for termination, but the FIN bit is used.

Closing a Connection

Closing a Connection

TCP State Machine In the figure, the label on each state transition shows what causes the transition and what TCP sends when it performs the transition. For example, the TCP software at each endpoint begins in the CLOSED state. Application programs must issue either a passive open command to wait for a connection from another machine, or an active open command to initiate a connection. An active open command forces a transition from the CLOSED state to the SYN SENT state. When it follows the transition to SYN SENT, TCP emits a SYN segment. When the other side returns a segment with the SYN and ACK bits set, TCP moves to the ESTABLISHED state, emits an ACK, and begins data transfer. The TIMED WAIT state reveals how TCP handles some of the problems incurred with unreliable delivery. TCP keeps a notion of maximum segment lifetime (MSL), the maximum time an old segment can remain alive in an internet. To avoid having segments from a previous connection interfere with a current one, TCP moves to the TIMED WAIT state after closing a connection. It remains in that state for twice the maximum segment lifetime before deleting its record of the connection. If any duplicate segments arrive for the connection during the timeout interval, TCP will reject them. However, to handle cases where the last acknowledgement was lost, TCP acknowledges valid segments and restarts the timer. Because the timer allows TCP to distinguish old connections from new ones, it prevents TCP from sending a reset in response to delayed segments from an old connection (e.g., if the other end retransmits a FIN segment).

Congestion Control Excessive traffic can cause packet loss. Transport protocols respond to lost packets with retransmission. Excessive retransmission can cause congestion collapse . TCP interprets packet loss as an indicator of congestion. The sender uses TCP congestion control and slows the transmission of packets. It first sends a single packet. If the acknowledgment returns without loss, it sends two packets. When TCP sends one-half of the window size, the rate of increase slows.

Summary UDP provides best-effort end-to-end message delivery. IP is used for delivery to destination host. Protocol ports demultiplex to the right destination application TCP provides reliable end-to-end byte stream delivery. IP is used for delivery to the destination host. Protocol ports demultiplex data to the right destination application. Additional techniques develop reliable delivery from IP messages: Positive acknowledgment with retransmission (PAR) Use round-trip time to adjust timeout intervals (Jacobsen, Karn) Sequence numbers to detect missing, duplicate and out-of-order data Sliding window flow control Clark’s and Nagle’s algorithms for silly window syndrome Three-way handshake for reliable connection and termination Congestion control algorithms