Chapter 3 Transport Layer
Total Page:16
File Type:pdf, Size:1020Kb
Chapter 3 Transport Layer A note on the use of these Powerpoint slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you see the animations; and can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: Computer § If you use these slides (e.g., in a class) that you mention their source (after all, we’d like people to use our book!) Networking: A Top § If you post any slides on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this Down Approach material. 7th edition Thanks and enjoy! JFK/KWR Jim Kurose, Keith Ross All material copyright 1996-2016 Pearson/Addison Wesley J.F Kurose and K.W. Ross, All Rights Reserved April 2016 Transport Layer 2-1 Chapter 3: Transport Layer our goals: § understand principles § learn about Internet behind transport transport layer protocols: layer services: • UDP: connectionless • multiplexing, transport demultiplexing • TCP: connection-oriented • reliable data transfer reliable transport • flow control • TCP congestion control • congestion control Transport Layer 3-2 Chapter 3 outline 3.1 transport-layer 3.5 connection-oriented services transport: TCP 3.2 multiplexing and • segment structure demultiplexing • reliable data transfer 3.3 connectionless • flow control transport: UDP • connection management 3.4 principles of reliable 3.6 principles of congestion data transfer control 3.7 TCP congestion control Transport Layer 3-3 Transport services and protocols application transport § provide logical communication network data link between app processes physical running on different hosts § transport protocols run in end systems • send side: breaks app messages into segments, passes to network layer • rcv side: reassembles application segments into messages, transport network passes to app layer data link physical § more than one transport protocol available to apps • Internet: TCP and UDP Transport Layer 3-4 Transport vs. network layer § network layer: logical communication household analogy: 12 kids in Ann’s house sending between hosts letters to 12 kids in Bill’s § transport layer: house: logical § hosts = houses communication § processes = kids between processes § app messages = letters in envelopes • relies on, enhances, § transport protocol = Ann network layer and Bill who demux to in- services house siblings § network-layer protocol = postal service Transport Layer 3-5 Internet transport-layer protocols application transport § reliable, in-order network data link delivery (TCP) physical network network data link • congestion control data link physical physical network • flow control data link • connection setup physical network data link § unreliable, unordered physical network delivery: UDP data link physical network • no-frills extension of data link application physical “best-effort” IP network transport data link network physical data link § services not available: physical • delay guarantees • bandwidth guarantees Transport Layer 3-6 Chapter 3 outline 3.1 transport-layer 3.5 connection-oriented services transport: TCP 3.2 multiplexing and • segment structure demultiplexing • reliable data transfer 3.3 connectionless • flow control transport: UDP • connection management 3.4 principles of reliable 3.6 principles of congestion data transfer control 3.7 TCP congestion control Transport Layer 3-7 Multiplexing/demultiplexing multiplexing at sender: handle data from multiple demultiplexing at receiver: 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 transport network transport network link network link physical link physical physical Transport Layer 3-8 How demultiplexing works § host receives IP datagrams 32 bits • each datagram has source IP source port # dest port # address, destination IP address other header fields • each datagram carries one transport-layer segment • each segment has source, application destination port number data § host uses IP addresses & (payload) port numbers to direct segment to appropriate socket TCP/UDP segment format Transport Layer 3-9 Connectionless demultiplexing § recall: created socket has § recall: when creating host-local port #: datagram to send into UDP DatagramSocket mySocket1 socket, must specify = new DatagramSocket(12534); • destination IP address • destination port # § when host receives UDP IP datagrams with same segment: dest. port #, but different • checks destination port # source IP addresses in segment and/or source port numbers will be directed • directs UDP segment to to same socket at dest socket with that port # Transport Layer 3-10 Connectionless demux: example DatagramSocket DatagramSocket serverSocket = new DatagramSocket DatagramSocket mySocket2 = new mySocket1 = new DatagramSocket (6428); DatagramSocket (9157); application (5775); application P1 application P3 P4 transport transport transport network network link network link physical link physical physical source port: 6428 source port: ? dest port: 9157 dest port: ? source port: 9157 source port: ? dest port: 6428 dest port: ? Transport Layer 3-11 Connection-oriented demux § TCP socket identified § server host may support by 4-tuple: many simultaneous TCP • source IP address sockets: • source port number • each socket identified by • dest IP address its own 4-tuple • dest port number § web servers have § demux: receiver uses all different sockets for four values to direct each connecting client segment to appropriate • non-persistent HTTP will socket have different socket for each request Transport Layer 3-12 Connection-oriented demux: example application application P4 P5 P6 application P3 P2 P3 transport transport transport network network link network link physical link physical server: IP physical address B host: IP source IP,port: B,80 host: IP address A dest IP,port: A,9157 source IP,port: C,5775 address C dest IP,port: B,80 source IP,port: A,9157 dest IP, port: B,80 source IP,port: C,9157 dest IP,port: B,80 three segments, all destined to IP address: B, dest port: 80 are demultiplexed to different sockets Transport Layer 3-13 Connection-oriented demux: example threaded server application application application P4 P3 P2 P3 transport transport transport network network link network link physical link physical server: IP physical address B host: IP source IP,port: B,80 host: IP address A dest IP,port: A,9157 source IP,port: C,5775 address C dest IP,port: B,80 source IP,port: A,9157 dest IP, port: B,80 source IP,port: C,9157 dest IP,port: B,80 Transport Layer 3-14 Chapter 3 outline 3.1 transport-layer 3.5 connection-oriented services transport: TCP 3.2 multiplexing and • segment structure demultiplexing • reliable data transfer 3.3 connectionless • flow control transport: UDP • connection management 3.4 principles of reliable 3.6 principles of congestion data transfer control 3.7 TCP congestion control Transport Layer 3-15 UDP: User Datagram Protocol [RFC 768] § “no frills,” “bare bones” § UDP use: Internet transport § streaming multimedia protocol apps (loss tolerant, rate § “best effort” service, UDP sensitive) segments may be: § DNS • lost § SNMP • delivered out-of-order § reliable transfer over to app UDP: § connectionless: § add reliability at • no handshaking application layer between UDP sender, receiver § application-specific error recovery! • each UDP segment handled independently of others Transport Layer 3-16 UDP: segment header length, in bytes of 32 bits UDP segment, source port # dest port # including header length checksum why is there a UDP? § no connection application establishment (which can data add delay) (payload) § simple: no connection state at sender, receiver § small header size UDP segment format § no congestion control: UDP can blast away as fast as desired Transport Layer 3-17 UDP checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment sender: receiver: § treat segment contents, § compute checksum of including header fields, received segment as sequence of 16-bit § integers check if computed checksum equals checksum field value: § checksum: addition (one’s complement sum) • NO - error detected of segment contents • YES - no error detected. § sender puts checksum But maybe errors value into UDP checksum nonetheless? More later field …. Transport Layer 3-18 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 wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 Note: when adding numbers, a carryout from the most significant bit needs to be added to the result * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Transport Layer 3-19 Chapter 3 outline 3.1 transport-layer 3.5 connection-oriented services transport: TCP 3.2 multiplexing and • segment structure demultiplexing • reliable data transfer 3.3 connectionless • flow control transport: UDP • connection management 3.4 principles of reliable 3.6 principles of congestion data transfer control 3.7 TCP congestion control Transport Layer 3-20 Principles of reliable data transfer § important in application, transport, link layers • top-10 list of important networking