310 likes | 437 Views
IT 424 Networks2. Chapter 3: Transport Layer Part 1: Services & UDP. Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross. TCP/IP Suite – Transport Layer. Transport Layer Functionalities. Transport Layer Protocols. Overview.
E N D
IT 424 Networks2 Chapter 3: Transport Layer Part 1: Services & UDP Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross
TCP/IP Suite – Transport Layer Transport Layer Functionalities Transport Layer Protocols Overview User Datagram Protocol (UDP)
Differentiate between the transport layer and the network layer 1 Describe the role of the transport layer and its two main protocols 2 Explain how multiplexing and demultiplexing work 3 4 Differentiate between TCP and UDP services Select the most proper transport protocol for any application Calculate the check-sum in UDP packets 5 6 Learning Outcomes
TCP/IP Suite – Transport Layer Transport Layer Functionalities Transport Layer Protocols Overview User Datagram Protocol (UDP)
TCP/IP Suite TCP/IP Suite TCP
TCP/IP Suite Why We Need A Transport Layer? • Since several processes may be running on each host machine, a layer is needed to be responsible for process-to-process delivery (also called end-to-end delivery) • Transport layer works as a liaison between application layer and lower layers (network layer, data link layer, and physical layer) • Application layer programs use the services of the transport layer to communicate without being aware of the lower layers (i.e., not dependent on the physical network itself) • Transport layer uses the network layer services and implement its own internal functions to hide the imperfection and the heterogeneous nature of the physical network
TCP/IP Suite –Transport Layer application transport network data link physical application transport network data link physical logical end-end transport End-to-End Communication
TCP/IP Suite –Transport Layer application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical logical end-end transport Transport Services and Protocols • Transport layer provideslogical communication between application processes running on different hosts • Transport protocols run in end systems • send side: breaks app messages into segments, passes to network layer • receive side: reassembles segments into messages, passes to application layer • More than one transport protocol available to applications • Internet: TCP and UDP
TCP/IP Suite –Transport Layer Transport vs. Network Layer • Network layer: logical communication between hosts • Transport layer: logical communication between processes • Relies on, enhances, network layer services
TCP/IP Suite – Transport Layer Transport Layer Functionalities Transport Layer Protocols Overview User Datagram Protocol (UDP)
Transport Layer Functionalities Transport Layer Functionalities • Isolating the application layer from the technology, design, and imperfections of the network (hiding transmission details from applications) • Fragmentation of large messages into segments and reassembly of segments into messages (segmentation) • Addressing • Multiplexing / Demultiplexing • Reliable data transfer (provide a reliable service on top of an unreliable network) • QoS , security functions (cooperation with other layers)
Transport Layer Functionalities - Segmentation Segmentation Message From app layer … Transport Layer TH payload … segment • The transport layer receives the message from the application process and divides it into smaller units then encapsulates each unit in a segment (also called packet) by adding header information To network layer
Transport Layer Functionalities - Addressing Addressing • For two application processes to communicate, they need to uniquely identify each other using socket address: • IP address which uniquely distinguish a computer from all other computers (responsibility of the network layer) • A port number (local number) to uniquely identify a process on the computer (i.e. uniquely identify a process at the transport layer) • A request segment at the transport layer must carry • The destination port to specify remote process • As well as the source port to specify the sender process
Transport Layer Functionalities - Addressing Addressing (Example)
Transport Layer Functionalities - Multiplexing Multiplexing and Demultiplexing many-to-one relationship one-to-many relationship • Multiplexing – at the sender, the transport layer protocol accepts messages from several processes identified by their port numbers then passes the packets to the network layer after adding the header • Demultiplexing – at the receiver, the transport layer delivers each message to appropriate process based on the port number contained in the header
Transport Layer Functionalities - Multiplexing How Demultiplexing Works 32 bits source port # dest port # • Host receives IP datagrams • Each datagram has source IP address, destination IP address • Each datagram carries one transport-layer segment • Each segment has source, destination port number • Host uses IP addresses & port numbers to direct segment to appropriate socket other header fields application data (payload) TCP/UDP segment format
Transport Layer Functionalities - Multiplexing handle data from multiple sockets, add transport header (later used for demultiplexing) use header info to deliver received segments to correct socket multiplexing at sender: demultiplexing at receiver: Multiplexing/Demultiplexing application P1 P2 application application socket P4 P3 transport process network transport transport link network network physical link link physical physical
Transport Layer Functionalities - Multiplexing source port: 9157 dest port: 6428 source port: ? dest port: ? source port: 6428 dest port: 9157 source port: ? dest port: ? Demultiplexing Example DatagramSocketserverSocket = new DatagramSocket (6428); DatagramSocket mySocket2 = new DatagramSocket (9157); DatagramSocket mySocket1 = new DatagramSocket (5775); application application application P1 P3 P4 transport transport transport network network network link link link physical physical physical
Transport Layer Functionalities - Reliable Data Reliable Data Transfer • Very important network topic (for transport, application, and link layers) • Characteristics of unreliable channel will determine the complexity of reliable data transfer protocol • How to provide a reliable transmission over a non reliable channel or a non reliable network layer? • Reliable channel: No transferred data bits are corrupted or lost, and all are delivered in the order in which they were sent
TCP/IP Suite – Transport Layer Transport Layer Functionalities Transport Layer Protocols Overview User Datagram Protocol (UDP)
Transport Layer Protocols application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical logical end-end transport Internet Transport-Layer Protocols • Reliable, in-order delivery (TCP) • Error control • Congestion control • Flow control • Connection setup (connection-oriented) • Unreliable, unordered delivery: UDP • Connectionless • Extension of “best-effort” IP • Services not available: • Delay guarantees • Bandwidth guarantees
Transport Layer Protocols 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)
TCP/IP Suite – Transport Layer Transport Layer Functionalities Transport Layer Protocols Overview User Datagram Protocol (UDP)
User Datagram Protocol (UDP) User Datagram Protocol (UDP) [RFC 768] • “No frills,” Internet transport protocol • “Best effort” service, UDP segments may be: • Lost • Delivered out-of-order to application • Connectionless: • No handshaking between UDP sender, receiver • Each UDP segment handled independently of others • UDP use: • Streaming multimedia applications (loss tolerant, delay sensitive) • DNS • SNMP • Reliable transfer over UDP: • Add reliability at application layer • Application-specific error recovery!
User Datagram Protocol (UDP) - Header UDP: Segment Header length, in bytes of UDP segment, including header 32 bits source port # dest port # • No connection establishment (which can add delay) • Simple: no connection state at sender, receiver • Small header size • No congestion control: UDP can blast away as fast as desired checksum length Why is there a UDP? application data (payload) UDP segment format
User Datagram Protocol (UDP) - Checksum UDP Checksum Goal:detect “errors” (e.g., flipped bits) in transmitted segment Sender: • Treat segment contents, including header fields, as sequence of 16-bit integers • Checksum: addition (one’s complement sum) of segment contents • Sender puts checksum value into UDP checksum field Receiver: • Compute checksum of received segment • Check if computed checksum equals checksum field value: • NO - error detected • YES - no error detected. But maybe errors nonetheless?
User Datagram Protocol (UDP) - Checksum Internet Checksum: Example Example: add two 16-bit integers 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 wraparound sum checksum Note: when adding numbers, a carryout from the most significant bit needs to be added to the result
User Datagram Protocol (UDP) - Checksum Checksum Calculation of A Simple UDP Datagram • Figure above shows the checksum calculation for a very small user datagram with only 7 bytes of data. • Because the number of bytes of data is odd, padding is added for checksum calculation. • The pseudo-header as well as the padding will be dropped when the user datagram is delivered to IP.
User Datagram Protocol (UDP) - Uses Uses of UDP • Used by a process that requires simple request-response communication with little concern for flow and error control. • Not used for processes that send a bulk of data such as FTP. • Used by a process with internal flow and error control mechanisms, ex: Trivial File Transfer Protocol (TFTP). • Multicasting, multicasting capability is embedded in the UDP software but not in the TCP software. • Management processes, ex: SNMP. • Route updating protocols, ex: RIP.
Conclusion Conclusion • Principles behind transport layer services: • Segmentation • Addressing • Multiplexing, demultiplexing • Reliable data transfer • Instantiation, implementation in the Internet • UDP • TCP • UDP uses checksum to detect errors. It provides unreliable unordered data service
References References • Computer Networking: A Top-Down Approach Featuring the Internet by James Kurose and Keith Ross, Addison Wesley, 2012 (chapter 3 ) • Internet Protocol (RFC791) • User Datagram Protocol (RFC768)