Goals ❒ Understand transport services Transport Overview and UDP ❍ Multiplexing and Demultiplexing ❍ Reliable data transfer ❍ Flow control ❍ Congestion control ❒ TCP and UDP Transport Layer Transport services and protocols ❒ provide logical communication end systems ❍ send side: breaks app messages into segments, passes to network layer netw ork data li nk physi cal t or sp an tr ❍ ❒ netw ork data li nk physi cal ❒ netw ork data li nk physi cal netw ork data li nk physi cal appli cati o n transport netw ork data li nk physi cal rcv side: reassembles segments into messages, passes to app layer 3-2 Transport vs. network layer netw ork data li nk physi cal d en den ❒ transport protocols run in appli cati o n transport netw ork data li nk physi cal l ca gi lo between app processes running on different hosts Transport Layer 3-1 network layer: logical communication between hosts Household analogy: transport layer: logical communication between processes ❒ app messages = letters in ❍ 12 kids sending letters to 12 kids ❒ processes = kids envelopes ❒ hosts = houses ❒ transport protocol = Ann relies on, enhances, network layer services and Bill ❒ network-layer protocol = postal service ❒ more than one transport protocol available to apps ❍ Internet: TCP and UDP Transport Layer Internet transport-layer protocols ❒ ❍ flow control ❍ connection setup unreliable, unordered delivery: UDP ❍ ❒ no-frills extension of “best-effort” IP services not available: ❍ delay guarantees ❍ bandwidth guarantees netw ork data li nk physi cal netw ork data li nk physi cal = socket netw ork data li nk physi cal application netw ork data li nk physi cal transport appli cati o n transport netw ork data li nk physi cal network link Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) 3-5 = process P3 P1 P1 application transport network P2 P4 application transport network link link physical host 1 Transport Layer 3-4 Multiplexing/demultiplexing Demultiplexing at rcv host: delivering received segments to correct socket netw ork data li nk physi cal t or sp an tr congestion control d en den ❍ appli cati o n transport netw ork data li nk physi cal l ca gi lo ❒ reliable, in-order delivery (TCP) Transport Layer 3-3 physical host 2 physical host 3 Transport Layer 3-6 1 Connectionless demultiplexing How demultiplexing works ❒ host receives IP datagrams ❍ ❍ ❍ each datagram has source IP address, destination IP address 32 bits source port # each datagram carries 1 transport-layer segment ❒ dest port # ❒ application data (message) ❒ host uses IP addresses & Transport Layer P2 SP: 6428 DP: 9157 ❒ SP: 5775 DP: 6428 Client IP:B SP provides “return address” Transport Layer P4 SP: 9157 DP: 80 S-IP: A D-IP:C P5 server IP: C P6 TCP socket identified by 4-tuple: ❍ source IP address ❍ source port number ❍ dest IP address ❍ dest port number ❒ IP datagrams with different source IP addresses and/or source port numbers directed to same socket recv host uses all four values to direct segment to appropriate socket ❒ each socket identified by its own 4-tuple Web servers have different sockets for each connecting client ❍ non-persistent HTTP will have different socket for each requestTransport Layer 3-10 Connection-oriented demux: Threaded Web Server P2 P1P3 P1 P2 P4 SP: 5775 DP: 80 SP: 5775 DP: 80 S-IP: B D-IP:C S-IP: B D-IP:C SP: 9157 DP: 80 S-IP: B D-IP:C 3-8 Server host may support many simultaneous TCP sockets: ❍ 3-9 Connection-oriented demux (cont) client IP: A ❒ SP: 6428 DP: 5775 server IP: C directs UDP segment to socket with that port number Connection-oriented demux P1 P1 P3 checks destination port number in segment Transport Layer 3-7 DatagramSocket serverSocket = new DatagramSocket(6428); P1 ❒ (dest IP address, dest port number) Connectionless demux (cont) SP: 9157 DP: 6428 ❍ TCP/UDP segment format port numbers to direct segment to appropriate socket client IP: A UDP socket identified by two-tuple: When host receives UDP segment: ❍ DatagramSocket mySocket1 = new DatagramSocket(99111); DatagramSocket mySocket2 = new DatagramSocket(99222); other header fields each segment has source, destination port number (recall: well-known port numbers for specific applications) ❒ Create sockets with port numbers: Client IP:B Transport Layer 3-11 client IP: A SP: 9157 DP: 80 S-IP: A D-IP:C server IP: C SP: 9157 DP: 80 S-IP: B D-IP:C P1P3 Client IP:B Transport Layer 3-12 2 UDP: User Datagram Protocol [RFC 768] ❒ ❒ “no frills,” “bare bones” Internet transport protocol ❒ often used for streaming multimedia apps “best effort” service, UDP segments may be: ❍ ❍ ❒ UDP: more lost delivered out of order to app ❒ connectionless: ❍ no handshaking between UDP sender, receiver ❍ each UDP segment handled independently of others ❍ loss tolerant ❍ rate sensitive other UDP uses ❍ DNS ❍ SNMP Length, in bytes of UDP segment, including header 32 bits source port # dest port # length checksum ❒ reliable transfer over UDP: add reliability at application layer ❍ application-specific error recovery! Transport Layer 3-13 Transport Layer 3-14 ❒ Goal: detect “errors” (e.g., flipped bits) in transmitted segment Receiver: ❒ treat segment contents ❒ compute checksum of as sequence of 16-bit integers received segment ❒ sender puts checksum value into UDP checksum field Note ❍ Sender: complement sum) of segment contents UDP segment format Internet Checksum Example UDP checksum ❒ checksum: addition (1’s Application data (message) ❒ When adding numbers, a carryout from the most significant bit needs to be added to the result Example: add two 16-bit integers ❒ check if computed checksum 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 equals checksum field value: ❍ ❍ NO - error detected YES - no error detected. But maybe errors nonetheless? More later …. Transport Layer 3-15 wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 sum checksum 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 Transport 0 0 1Layer 1 3-16 3
© Copyright 2026 Paperzz