1 / 56

The Transport Layer

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. logical end-end transport.

Télécharger la présentation

The 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. 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 logical end-end transport The Transport Layer • Provides logical communication between processes • network layer: data transfer between end systems • transport layer: data transfer between processes • Two types of transport service is available • connection-oriented • connectionless Transport Layer Issues

  2. Why is there a transport layer? • Historically the network layer was part of the communications subnet and is run by the carrier. • The transport layer forms a boundary between the provider and user of the reliable transmission service • Some make the following distinction: • transport service provider (layers 1-4) • transport service user (above 4) Transport Layer Issues

  3. Addressing • Transport addresses typically need to include more than a machine address • Many names, but the idea is essentially the same • (IP address, local port) • (AAL, SAP) • (NSAP, TSAP) • One component the destination, the second identifies an end point destination Transport Layer Issues

  4. Determining the End-Point • How does one determine what end-point a service is installed on? • One technique is to agree on a set of “well-known” end-points Transport Layer Issues

  5. Initial Connection Protocol • Each machine wishing to offer services has a special process server • The process server scans a series of ports looking for connections • When a connection request is received, the process server starts the appropriate process to service the request • In UNIX this is handled by inetd Transport Layer Issues

  6. Name Server • A special process, called a name server or sometimes a directory server, to solve the addressing problem • Here clients ask the name server what end-point address the desired service is running on • This requires services to register themselves with the name server Transport Layer Issues

  7. Transport Protocols • Transport protocols often need to make an unreliable channel appear to be error free • Transport protocols typically deal with • error control, sequencing, and flow control • Issues that affect transport protocols • routing • connection establishment • storage capacity on the net • sophisticated buffering/flow control techniques Transport Layer Issues

  8. Principles of Reliable data transfer Transport Layer Issues

  9. Elementary Link Protocols • Need to provide enable reliable delivery using an unreliable delivery • All packets are received • Packets are received in the correct order • No duplicates – what we send is what is received • The discussion that follows is based on • Computer Networks, by Tannenbaum Transport Layer Issues

  10. Utopia • Assumptions • Data transmission in one direction only • The communication channel is assumed to be error free • The receiver is assumed to be able to process all the input infinitely fast • Just a simple example to get used to terminology Transport Layer Issues

  11. Utopia – Pseudo-code void sender(void) { frame s; // outbound frame packet p; // outbound packet while (true) { // Get something to send from_network_layer(&p); // Prepare for transmission s.info = p; // Send it to_physical_layer(&s); } } void receiver(void) { frame r; // inbound frame event_type event; // Not used while (true) { // Only possibility is // frame arrival wait_for_event(&event); // Get frame from_physical_layer(&r); // Pass to Network Layer to_network_layer(&r.info); } } Transport Layer Issues

  12. Utopia in Action Packet A Frame A Packet A Frame B Packet B Packet B Packet C Frame C Packet C Transport Layer Issues

  13. Stop & Wait • Assumptions • Data transmission in one direction only, from sender to receiver (but can send in both directions) • The communication channel is assumed to be error free • The receiver has only finite buffer capacity and a finite processing speed Transport Layer Issues

  14. Stop & Wait – Pseudo-code void sender(void) { frame s; // outbound frame packet p; // outbound packet event_type e; while (true) { // Get and send from_network_layer(&p); s.info = p; to_physical_layer(&s); // Wait for ACK wait_for_event( &e ); } } void receiver(void) { frame r; // inbound frame frame s; // ack frame event_type event; // Not used while (true) { // Only possibility is // frame arrival wait_for_event(&event); // Get and pass up from_physical_layer(&r); to_network_layer(&r.info); // Send ACK to_physical_layer( &s ); } } Transport Layer Issues

  15. PAR • Assumptions • Data transmission in one direction only, from sender to receiver. • The receiver has only finite buffer capacity and a finite processing speed. • The communication channel is not assumed to be error free. • Error recovery is done by error detection and retransmission of corrupted frames. • The receiver sends • an ACK when the received frame is (considered) error-free • a NACK when the received frame is corrupted • Flow control can be achieved by sending nothing for a while. • The sender must keep the transmitted frame in a buffer until it is acknowledged. Transport Layer Issues

  16. PAR - Normal Frame A Packet A ACK Packet A Frame B Packet B ERROR NACK Frame B Packet B Packet B ACK Transport Layer Issues

  17. PAR – Lost Frame Frame A Packet A ACK Packet A Frame B Packet B ERROR TIMEOUT Frame B Packet B Packet B ACK Transport Layer Issues

  18. Timeouts • Sender waits for ACK and times out and retransmits • With time outs, NACKs are not necessary • But are usually more efficient • Flow control is now based on time out • Problem is that ACKs can get lost too!! Transport Layer Issues

  19. PAR – Lost ACK Frame A Packet A ACK Packet A Frame B Packet B Packet B ACK TIMEOUT Frame B Packet B Packet B ACK Transport Layer Issues

  20. Numbering Messages • Assumptions • Same as before • Protocol Changes • Sender maintains a one-bit counter • Incremented when ACK is received • Value of counter placed in header • Receiver • Has one-bit counter (tells last frame received) • Correct frame • No error • Right number Transport Layer Issues

  21. PAR – Lost ACK Frame A:0 Packet A ACK Packet A Frame B:1 Packet B Packet B ACK TIMEOUT Frame B:1 Packet B DUPLICATE DISCARD ACK Transport Layer Issues

  22. Race Condition Frame A:0 Packet A ACK Packet A TIMEOUT Frame A:0 Packet B Frame B:1 DUPLICATE DISCARD ACK Packet C Frame C:1 DUPLICATE DISCARD ACK Transport Layer Issues

  23. Numbering ACKs • Assumptions • Same as before • Protocol Changes • ACKs are numbered as well • Can be proved correct assuming • No re-ordering of messages or ACKs Transport Layer Issues

  24. It Works!! Frame A:0 Packet A ACK:0 Packet A TIMEOUT Frame A:0 Packet B Frame B:1 DUPLICATE DISCARD ACK:0 DUPLICATE DISCARD TIMEOUT Frame B:1 Packet B ACK:1 Transport Layer Issues

  25. Simplex Transmission Data A  B Layer 2 Sender A Layer 2 Receiver B Control B  A Unidirectional data transmission Transport Layer Issues

  26. Full Duplex Transmission Data A  B Layer 2 Sender A Layer 2 Receiver B Control B  A Data B  A Control A  B Seems silly to have two simplex channels Transport Layer Issues

  27. Piggy-backed ACKs Data A  B Control A  B Layer 2 Sender A Layer 2 Receiver B Data B  A Control B  A Transport Layer Issues

  28. Stop & Wait – Pseudo-code void sender(void) { frame f; int sent = 0; int expect = 0; while (true) { f.ack = 1 - expect; f.seq = sent; // Send 1st frame to_physical_layer( &f ); from_physical_layer( &f ); // Receive frame if ( f.ack == sent && !timeout ) { // Handle ACK from_network_layer( &f.info ); sent = 1 – sent; } if ( f.seq == expect && !timeout) { // Handle data to_network_layer( &f.info ); expect = 1 – expect; } } Transport Layer Issues

  29. Stop & Wait – Pseudo-code void sender(void) { frame f; int sent = 1; int expect = 0; while (true) { from_physical_layer( &f ); // Receive frame if ( f.ack == sent && !timeout ) { // Handle ACK from_network_layer( &f.info ); sent = 1 – sent; } if ( f.seq == expect && !timeout) { // Handle data to_network_layer( &f.info ); expect = 1 – expect; } f.ack = 1 - expect; f.seq = sent; // Send 1st frame to_physical_layer( &f ); } Transport Layer Issues

  30. Piggyback A sends (0, 1, A0) B gets (0, 1, A0) B sends(0, 0, B0) A gets (0, 0, B0) A sends(1, 0, A1) B gets (1, 0, A1) B sends(1, 1, B1) A gets (1, 1, B1) A sends(0, 1, A2) B gets (0, 1, A2) B sends(0, 0, B2) A gets (0, 0, B2) A sends(1, 0, A3) B gets (1, 0, A3) B sends(1, 1, B3) Notation: ( frame number, piggybacked ACK, frame ) Transport Layer Issues

  31. Lost Packet A sends (0, 1, A0) B gets (0, 1, A0) B sends(0, 0, B0) A gets (0, 0, B0) A sends(1, 0, A1) B gets (1, 0, A1) B sends(1, 1, B1) TIMEOUT A sends(1, 0, A1) B gets (1, 0, A1) B sends(1, 1, B1) A gets (1, 1, B1) A sends(0, 1, A2) B gets (0, 1, A2) B sends(0, 0, B2) Notation: ( frame number, piggybacked ACK, frame ) Transport Layer Issues

  32. Simultaneous Start B sends(0, 1, B0) B gets(0, 1, A0) B sends(0, 0, B0) A sends (0, 1, A0) A gets (0, 1, B0) A sends(0, 0, A0) B gets (0, 0, A0) B sends(1, 0, B1) A gets (0, 0, B0) A sends(1, 0, A1) B gets (1, 0, A1) B sends(1, 1, B1) A gets (1, 0, B1) A sends(1, 1, A1) B gets (1, 1, A1) B sends(0, 1, B2) Notation: ( frame number, piggybacked ACK, frame ) Transport Layer Issues

  33. Where L = length of the frame b = data rate R = round trip delay L/b = transmission R/2 = transit Bad if R >> (satellite) b >> (high speed) L << (small frame) Analysis 1st bit of frame L/b Last bit of frame R ACK (one bit long) Usage: (L/b) /( R + L/b) or L / ( L + Rb) Transport Layer Issues

  34. More Outstanding? • Why only 1 outstanding frame? • Minimizes buffer size • Wastes bandwidth • Sliding windows protocols • Basically what we have been looking at • Except that multiple packets can be un-ACKd • How • That is the window size Transport Layer Issues

  35. Transmission Window • ACK for the first packet "slides" the window along to the next packet. • The window partitions • successfully transmitted • waiting acknowledgements • waiting to be transmitted Transport Layer Issues

  36. Sender allows multiple, “in-flight”, yet-to-be-acknowledged packets range of sequence numbers must be increased buffering at sender and/or receiver Pipelined protocols Transport Layer Issues

  37. How to Handle Loss • Assuming a window size greater than 1 • What action do you take if you detect a packet loss • Two general strategies • Go back N • Selective Repeat Transport Layer Issues

  38. Go-Back-N • Receiver ACKs packets in order • Discards unexpected packets • Sender retransmits everything in window when detects loss of ACK Transport Layer Issues

  39. GBN inaction Transport Layer Issues

  40. Receiver individually acknowledges all correctly received packets Buffers packets, as needed, for eventual in-order delivery to upper layer Sender only resends packets for which ACK not received Sender timer for each unACKed packet Sender window N consecutive sequence #’s Selective Repeat Transport Layer Issues

  41. Selective Repeat Transport Layer Issues

  42. Selective repeat in action Transport Layer Issues

  43. 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) Seq #s must be larger than window size Selective Repeat: Dilemma Transport Layer Issues

  44. Problems With Connections • The crux of most of the problems are delayed duplicates • Throwaway transport addresses • Each connection has a unique address • Server model cannot work • Connection identifiers • A unique number that identifies each connection • What happens when a host crashes? • Try killing old packets (aging) Transport Layer Issues

  45. Restricting Packet Lifetime • Packet lifetime can be restricted • Restricted subnet design • Hop counters • Timestamps • Not only do we need to kill packets, but any ACKs of the packets as well • T is some multiple of the true packet lifetime. After waiting T units all traces of the packet are gone Transport Layer Issues

  46. Generating Sequence Numbers • With packet lifetimes limited, it is possible to devise a way to generate sequence numbers safely • Basic idea is to generate sequence numbers such that two identically numbered packets are never outstanding at the same time (for one connection) • Equip each machine with a clock that never stops • Takes on the form of a binary counter • Incremented at regular intervals • Number of bits equals/exceeds size of sequence number Transport Layer Issues

  47. Generating Sequence Numbers • At connection set up, the low order k bits of the clock are used as the initial sequence number. • Each connection starts with a different sequence number • Once the initial sequence number is picked, things work as before • The sequence space is so large that by the time sequence numbers wrap, the old packets are long gone Transport Layer Issues

  48. Host Crashes • When a host crashes, and then restarts, it does not know where it was in the sequence space • One solution is to require transport entities to be idle for T seconds after recovery to let all old packets dies off • If T is large, as it would be in a complex internetwork, this strategy is unattractive. Transport Layer Issues

  49. Example • Let T = 60sec and the clock ticks once per second • At time = 30secs, a packet is sent with with sequence number 80 (this is an existing connection, packet lives until time = 90secs) • The machine crashes and restarts • At time = 70secs, it reopens the connection, and uses initial sequence number 70 • Within the next 15secs it sends packets 70-80 • At time=85secs two packets with sequence 80 exist Transport Layer Issues

  50. Forbidden Regions • We must prevent sequence numbers from being used for a time T before their potential use as initial sequence numbers • The forbidden region indicates the illegal combinations of time and sequence number • Before sending any packet, on any connection, the clock must be checked to be sure the packet is not in a forbidden region Transport Layer Issues

More Related