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