1 / 113

Chapter 3 Transport Layer

This chapter covers the principles and services of the transport layer in computer networking, including multiplexing, demultiplexing, reliable data transfer, flow control, and congestion control. It also discusses the transport layer protocols TCP and UDP.

sylviah
Download Presentation

Chapter 3 Transport Layer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3Transport Layer Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007. Computer Networking: A Top Down Approach, 5th edition. Jim Kurose, Keith RossAddison-Wesley, April 2009. Transport Layer

  2. Our goals: understand principles behind transport layer services: Multiplexing, demultiplexing reliable data transfer flow control congestion control learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport TCP congestion control Chapter 3: Transport Layer Transport Layer

  3. 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Chapter 3 outline Transport Layer

  4. provide logical communication between app processes running on different hosts transport protocols run in end systems send side: breaks app messages into segments, passes to network layer rcv side: reassembles segments into messages, passes to app layer more than one transport protocol available to apps Internet: TCP and UDP application transport network data link physical application transport network data link physical logical end-end transport Transport services and protocols Transport Layer

  5. reliable, in-order delivery to app: TCP congestion control flow control connection setup unreliable, unordered delivery to app: UDP no-frills extension of “best-effort” IP services not available: delay guarantees bandwidth guarantees 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 logical end-end transport Internet transport-layer protocols Transport Layer

  6. 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Chapter 3 outline Transport Layer

  7. Multiplexing at send host: Demultiplexing at rcv host: Multiplexing/demultiplexing delivering received segments to correct socket gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) = socket = process application P4 application application P1 P2 P3 P1 transport transport transport network network network link link link physical physical physical host 3 host 2 host 1 Transport Layer

  8. host receives IP datagrams each datagram has source, destination IP addresses each datagram carries 1 transport-layer segment each segment has source, destination port numbers host uses IP addresses & port numbers to direct segment to appropriate socket, process, application How demultiplexing works: General for TCP and UDP 32 bits source port # dest port # other header fields application data (message) TCP/UDP segment format Transport Layer

  9. Create sockets with port numbers: DatagramSocket mySocket1 = new DatagramSocket(12534); DatagramSocket mySocket2 = new DatagramSocket(12535); UDP socket identified by two-tuple: (dest IP address, dest port number) When host receives UDP segment: checks destination port number in segment directs UDP segment to socket with that port number IP datagrams with different source IP addresses and/or source port numbers directed to same socket Connectionless demultiplexing Transport Layer

  10. P3 P2 P1 P1 SP: 9157 client IP: A DP: 6428 Client IP:B server IP: C SP: 5775 SP: 6428 SP: 6428 DP: 6428 DP: 9157 DP: 5775 Connectionless demux (cont) DatagramSocket serverSocket = new DatagramSocket(6428); SP provides “return address” Transport Layer

  11. TCP socket identified by 4-tuple: source IP address source port number dest IP address dest port number recv host uses all four values to direct segment to appropriate socket Server host may support many simultaneous TCP sockets: 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 request Connection-oriented demux Transport Layer

  12. SP: 9157 SP: 5775 P1 P1 P2 P4 P3 P6 P5 client IP: A DP: 80 DP: 80 Connection-oriented demux (cont) S-IP: B D-IP:C SP: 9157 DP: 80 Client IP:B server IP: C S-IP: A S-IP: B D-IP:C D-IP:C Transport Layer

  13. 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Chapter 3 outline Transport Layer

  14. “no frills,” “bare bones” transport protocol “best effort” service, UDP segments may be: lost delivered out of order to app connectionless: no handshaking between UDP sender, receiver each UDP segment handled independently Why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can blast away as fast as desired (more later on interaction with TCP!) UDP: User Datagram Protocol [RFC 768] Transport Layer

  15. often used for streaming multimedia apps loss tolerant rate sensitive other UDP uses DNS SNMP (net mgmt) reliable transfer over UDP: add reliability at app layer application-specific error recovery! used for multicast, broadcast in addition to unicast (point-point) UDP: more 32 bits source port # dest port # Length, in bytes of UDP segment, including header checksum length Application data (message) UDP segment format Transport Layer

  16. 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Chapter 3 outline Transport Layer

  17. important in app., transport, link layers top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Principles of Reliable data transfer Transport Layer

  18. important in app., transport, link layers top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Principles of Reliable data transfer Transport Layer

  19. important in app., transport, link layers top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Principles of Reliable data transfer Transport Layer

  20. rdt_send():called from above, (e.g., by app.). Passed data to deliver to receiver upper layer deliver_data():called by rdt to deliver data to upper udt_send():called by rdt, to transfer packet over unreliable channel to receiver rdt_rcv():called when packet arrives on rcv-side of channel Reliable data transfer: getting started send side receive side Transport Layer

  21. Flow Control • End-to-end flow and Congestion control study is complicated by: • Heterogeneous resources (links, switches, applications) • Different delays due to network dynamics • Effects of background traffic • We start with a simple case: hop-by-hop flow control Transport Layer

  22. Hop-by-hop flow control • Approaches/techniques for hop-by-hop flow control • Stop-and-wait • sliding window • Go back N • Selective reject Transport Layer

  23. underlying channel perfectly reliable no bit errors, no loss of packets stop and wait Stop-and-wait: reliable transfer over a reliable channel Sender sends one packet, then waits for receiver response Transport Layer

  24. underlying channel may flip bits in packet checksum to detect bit errors the question: how to recover from errors: acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK negative acknowledgements (NAKs): receiver explicitly tells sender that pkt had errors sender retransmits pkt on receipt of NAK new mechanisms for: error detection receiver feedback: control msgs (ACK,NAK) rcvr->sender channel with bit errors Transport Layer

  25. What happens if ACK/NAK corrupted? sender doesn’t know what happened at receiver! can’t just retransmit: possible duplicate Handling duplicates: sender retransmits current pkt if ACK/NAK garbled sender adds sequence number to each pkt receiver discards (doesn’t deliver up) duplicate pkt Stop-and-wait: Corrupt ACK/NACK Transport Layer

  26. Sender: seq # added to pkt two seq. #’s (0,1) will suffice. Why? must check if received ACK/NAK corrupted Receiver: must check if received packet is duplicate state indicates whether 0 or 1 is expected pkt seq # note: receiver can not know if its last ACK/NAK received OK at sender discussion Transport Layer

  27. New assumption: underlying channel can also lose packets (data or ACKs) checksum, seq. #, ACKs, retransmissions will be of help, but not enough Approach: sender waits “reasonable” amount of time for ACK retransmits if no ACK received in this time if pkt (or ACK) just delayed (not lost): retransmission will be duplicate, but use of seq. #’s already handles this receiver must specify seq # of pkt being ACKed requires countdown timer channels with errors and loss Transport Layer

  28. Stop-and-wait operation Summary • Stop and wait: • sender awaits for ACK to send another frame • sender uses a timer to re-transmit if no ACKs • if ACK is lost: • A sends frame, B’s ACK gets lost • A times out & re-transmits the frame, B receives duplicates • Sequence numbers are added (frame0,1 ACK0,1) • timeout: should be related to round trip time estimates • if too small  unnecessary re-transmission • if too large  long delays Transport Layer

  29. Stop-and-wait with lost packet/frame Transport Layer

  30. Transport Layer

  31. Transport Layer

  32. Stop and wait performance • utilization – fraction of time sender busy sending • ideal case (error free) • u=Tframe/(Tframe+2Tprop)=1/(1+2a), a=Tprop/Tframe Transport Layer

  33. example: 1 Gbps link, 15 ms e-e prop. delay, 1KB packet: Performance of stop-and-wait L (packet length in bits) 8kb/pkt T = = = 8 microsec transmit R (transmission rate, bps) 10**9 b/sec • U sender: utilization – fraction of time sender busy sending • 1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link • network protocol limits use of physical resources! Transport Layer

  34. rdt3.0: stop-and-wait operation sender receiver first packet bit transmitted, t = 0 last packet bit transmitted, t = L / R first packet bit arrives RTT last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R Transport Layer

  35. consider losses • assume Timeout ~ 2 Tprop • on average need Nx attempts to get the frame through • p is the probability of frame being in error • Pr[k attempts are made before the frame is transmitted correctly]=pk-1.(1-p) • Nx=kPr[k]=1/(1-p) • For stop-and-wait U=Tframe/[Nx.(Tframe+2.Tprop)]=1/Nx(1+2a) U=[1-p]/(1+2a) • stop and wait is a conservative approach to flow control but is wasteful Transport Layer

  36. Sliding window techniques • TCP is a variant of sliding window • Includes Go back N (GBN) and selective repeat/reject • Allows for outstanding packets without Ack • More complex than stop and wait • Need to buffer un-Ack’ed packets & more book-keeping than stop-and-wait Transport Layer

  37. Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged pkts range of sequence numbers must be increased buffering at sender and/or receiver Two generic forms of pipelined protocols: go-Back-N, selective repeat Pipelined (sliding window) protocols Transport Layer

  38. Pipelining: increased utilization sender receiver first packet bit transmitted, t = 0 last bit transmitted, t = L / R first packet bit arrives RTT last packet bit arrives, send ACK last bit of 2nd packet arrives, send ACK last bit of 3rd packet arrives, send ACK ACK arrives, send next packet, t = RTT + L / R Increase utilization by a factor of 3! Transport Layer

  39. Sender: k-bit seq # in pkt header “window” of up to N, consecutive unack’ed pkts allowed Go-Back-N • ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” • may receive duplicate ACKs (more later…) • timer for each in-flight pkt • timeout(n): retransmit pkt n and all higher seq # pkts in window Transport Layer

  40. ACK-only: always send ACK for correctly-received pkt with highest in-order seq # may generate duplicate ACKs need only remember expected seq num out-of-order pkt: discard (don’t buffer) -> no receiver buffering! Re-ACK pkt with highest in-order seq # GBN: receiver side Transport Layer

  41. GBN inaction Transport Layer

  42. receiver individually acknowledges all correctly received pkts buffers pkts, as needed, for eventual in-order delivery to upper layer sender only resends pkts for which ACK not received sender timer for each unACKed pkt sender window N consecutive seq #’s limits seq #s of sent, unACKed pkts Selective Repeat Transport Layer

  43. Selective repeat: sender, receiver windows Transport Layer

  44. data from above : if next available seq # in window, send pkt timeout(n): resend pkt n, restart timer ACK(n) in [sendbase,sendbase+N]: mark pkt n as received if n smallest unACKed pkt, advance window base to next unACKed seq # receiver sender Selective repeat pkt n in [rcvbase, rcvbase+N-1] • send ACK(n) • out-of-order: buffer • in-order: deliver (also deliver buffered, in-order pkts), advance window to next not-yet-received pkt pkt n in [rcvbase-N,rcvbase-1] • ACK(n) otherwise: • ignore Transport Layer

  45. Selective repeat in action Transport Layer

  46. Example: seq #’s: 0, 1, 2, 3 window size=3 receiver sees no difference in two scenarios! incorrectly passes duplicate data as new in (a) Q: what relationship between seq # size and window size? (check hwk), (try applet) Selective repeat: dilemma Transport Layer

  47. performance: • selective repeat: • error-free case: • if the window is w such that the pipe is fullU=100% • otherwise U=w*Ustop-and-wait=w/(1+2a) • in case of error: • if w fills the pipe U=1-p • otherwise U=w*Ustop-and-wait=w(1-p)/(1+2a) Transport Layer

  48. 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Chapter 3 outline Transport Layer

  49. full duplex data: bi-directional data flow in same connection MSS: maximum segment size connection-oriented: handshaking (exchange of control msgs) init’s sender, receiver state before data exchange flow controlled: sender will not overwhelm receiver point-to-point: one sender, one receiver reliable, in-order byte steam: no “message boundaries” pipelined: TCP congestion and flow control set window size send & receive buffers TCP: OverviewRFCs: 793, 1122, 1323, 2018, 2581 Transport Layer

  50. 32 bits source port # dest port # sequence number acknowledgement number head len not used Receive window U A P R S F checksum Urg data pnter Options (variable length) application data (variable length) TCP segment structure counting by bytes of data (not segments!) # bytes rcvr willing to accept Transport Layer

More Related