Transport Layer: UDP and TCP CS491G: Computer Networking Lab V. Arun Slides adapted from Kurose and Ross Transport Layer 3-1 Transport Layer: Outline 1 transport-layer 4 connection-oriented services transport: TCP 2 multiplexing and § segment structure demultiplexing § reliable data transfer § flow control 3 connectionless § connection management transport: UDP 5 principles of congestion control 6 TCP congestion control Transport Layer 3-2 Transport services and protocols application transport provide logical communication v network data lin k between app processes physical running on different hosts transport protocols run in v end systems § send side: breaks app messages into segments, passes to network layer § recv side: reassembles application segments into messages, transport network passes to app layer data lin k physical more than one transport v protocol available to apps § Internet: TCP and UDP Transport Layer 3-3 Transport vs. network layer network layer: logical v household analogy: communication between hosts 12 kids in Ann’s house sending letters to 12 kids in Bill’s house: hosts = houses transport layer: logical v v processes = kids communication v app messages = letters in between processes v envelopes § relies on and enhances transport protocol = Ann v network layer services and Bill who demux to in- house siblings network-layer protocol = v postal service Transport Layer 3-4 Internet transport-layer protocols application reliable, in-order v transport network delivery (TCP) data lin k physical network § congestion control network data lin k data lin k physical physical § flow control network data lin k § connection setup physical network unreliable, unordered data lin k v physical delivery: UDP network data lin k physical § no-frills extension of network data lin k application “best-effort” IP physical transport network network data lin k data lin k services not available: physical v physical § delay guarantees § bandwidth guarantees Transport Layer 3-5 Transport Layer: Outline 1 transport-layer 4 connection-oriented services transport: TCP 2 multiplexing and § segment structure demultiplexing § reliable data transfer § flow control 3 connectionless § connection management transport: UDP 5 principles of congestion control 6 TCP congestion control Transport Layer 3-6 Multiplexing/demultiplexing multiplexing at sender: demultiplexing at receiver: handle data from multiple sockets, add transport header use header info to deliver (later used for demultiplexing) received segments to correct socket application application P1 P2 application socket P3 P4 transport process network transport transport link network network physica l link link physica l physica l Transport Layer 3-7 How demultiplexing works host receives IP datagrams v 32 bits § each datagram has source source port # dest port # and destination IP address § each datagram carries one other header fields transport-layer segment § each segment has source and destination port number application host uses IP addresses & data v (payload) port numbers to direct segment to right socket TCP/UDP segment format Transport Layer 3-8 Connectionless demultiplexing recall: created socket has recall: when creating v v host-local port #: datagram to send into UDP socket, must specify DatagramSocket mySocket1 = new DatagramSocket(12534); § destination IP address § destination port # when host receives UDP IP datagrams with same v segment: dest. (IP, port), but different source IP addresses and/ § checks destination IP and or source port numbers port # in segment will be directed to same § directs UDP segment to socket socket bound to that (IP,port) Transport Layer 3-9 Connectionless demux: example DatagramSocket serverSocket = new DatagramSocket DatagramSocket DatagramSocket mySocket2 = new mySocket1 = new DatagramSocket (6428); DatagramSocket (9157); (5775); application application application P1 P3 P4 transport transport transport network network network link link link physica l physica l physica l source port: 6428 source port: ? dest port: 9157 dest port: ? source port: 9157 source port: ? dest port: 6428 dest port: ? Transport Layer 3-10
Description: