1 / 21

CHAPTER 3: TRANSPORT LAYER

CHAPTER 3: TRANSPORT LAYER. Transport Layer Services Establishing/Releasing Connections Multiplexing/Demultiplexing User Datagram Protocol (UDP) Reliable Data Transfer Flow Control Error Control Transmission Control Protocol (TCP) Congestion Control. TRANSPORT LAYER SERVICES.

kesia
Télécharger la présentation

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 3: TRANSPORT LAYER • Transport Layer Services • Establishing/Releasing Connections • Multiplexing/Demultiplexing • User Datagram Protocol (UDP) • Reliable Data Transfer • Flow Control • Error Control • Transmission Control Protocol (TCP) • Congestion Control

  2. TRANSPORT LAYER SERVICES Application Software Outside The Operating System Software Inside The Operating System Transport Internet Only IP Addresses Used Physical Addresses Used Network Interface Hardware CS 447 Chapter 3 Page 58

  3. OUTPUT PROCESS: FROM APPLICATION TO HARDWARE UDP Output TCP Output TCP Output Port Control Messages Queue For Datagrams Sent To IP TCP Timer Process TCP Output Process IP Process Queues For Outgoing Packets Net1 Device Net2 Device Netn Device Net1 Hardware Net2 Hardware Netn Hardware Application Programs Operating System An application calls a system routine to buffer data, and notify the output process. An application calls system routines to have UDP allocate an IP datagram, fill in the proper destination address, encapsulate the UDP packet, and send it to the IP process for delivery. When the IP process enqueues an outgoing datagram, a device driver routine is called to start the hardware. When the output has occurred, the interrupt handler dequeues the datagram and restarts the hardware to send the next datagram. The output process segments the data stream, encapsulates the TCP packets, and sends them to the IP process for delivery. Operating System Hardware Source: Internetworking with TCP/IP, Volume II by Douglas E. Comer and David L. Stevens CS 447 Chapter 3 Page 59

  4. INPUT PROCESS: FROM HARDWARE TO APPLICATION UDP Input TCP Input Semaphore- Controlled Buffers UDP Datagram Ports TCP Input Process Port For Segments Sent To TCP IP Process Queues For Packets Sent To IP Net1 Device Net2 Device Netn Device Net1 Hardware Net2 Hardware Netn Hardware Application Programs Operating System UDP packets are delivered to UDP ports, from which application programs read them. TCP packets are delivered to TCP buffers, from which application programs read them. IP demultiplexes packets and delivers them to appropriate transport protocol. Incoming IP datagrams are queued for the IP process. Operating System Hardware Source: Internetworking with TCP/IP, Volume II by Douglas E. Comer and David L. Stevens CS 447 Chapter 3 Page 60

  5. ESTABLISHING CONNECTIONS OLD DUPLICATE Connection Request (Sequence #A) OLD DUPLICATE Connection Request (Sequence #A) Connection Request (Sequence #A) Acknowledgement (Seq #B/Ack #A) Acknowledgement (Seq #B/Ack #A) Acknowledgement (Seq #B/Ack #A) Data Packet (Seq #C/Ack #B) REJECT (NAK #B) OLD DUPLICATE Data Packet (Seq #C/Ack #D) REJECT (NAK #B) In the Transport Layer, the common approach for establishing an end-to-end connection involves a three-way handshake. This approach helps to determine whether connection requests or acknowledgements are disposable duplicates or not. CS 447 Chapter 3 Page 61

  6. RELEASING CONNECTIONS Disconnect Request (Start Sender Timer) Disconnect Request (Start Sender Timer) Disconnect Request (Start Receiver Timer) Disconnect Request (Start Receiver Timer) Disconnect ACK Disconnect ACK (Connection Released) Disconnect Request (Start Receiver Timer) Disconnect Request (Start Sender Timer) Disconnect Request (Start Sender Timer) Disconnect Request (Start Receiver Timer) Disconnect Request (Start Receiver Timer) Disconnect Request (Start Sender Timer) Disconnect Request (Start Sender Timer) Disconnect Request (Start Sender Timer) Disconnect Request (Start Sender Timer) Disconnect ACK (Connection Released) Disconnect Request (Start Sender Timer) The three-way handshake is also used to release an end-to-end connection, since it facilitates the detection of lost disconnect messages and/or ACKs. Connection Released When Timer Expires Connection Released When Timer Expires N Times Connection Released When Timer Expires CS 447 Chapter 3 Page 62

  7. TRANSPORT LAYER COMMUNICATION The Transport Layer only deals with logical end-to-end message transport, but those messages are physically relayed through intermediary devices operating at lower layers. CS 447 Chapter 3 Page 63

  8. INTERNET TRANSPORT-LAYER PROTOCOLS • Transmission Control Protocol (TCP) • Connection-Oriented (end-to-end session is set up in advance) • Reliable, In-Order Delivery (packets are numbered and any missing packets are sent again) • Flow Control (transmission rate adjusted to receiver’s capacity to receive) • Congestion Control (throttles traffic to avoid bottlenecks) • User Datagram Protocol (UDP) • Connectionless (no end-to-end session is set up) • Unreliable, Unordered Delivery (depends on IP for “best delivery”) • No Congestion Avoidance (could hog excessive bandwidth) CS 447 Chapter 3 Page 64

  9. MULTIPLEXING Depending on the application layer service being used, a source host specifies a 16-bit source port number and a 16-bit destination port number, attaching a header to the outgoing application information that includes these port numbers. The endpoint in a Transport Layer communication is called a socket, with the port number and IP address comprising the socket address. Any specific Transport Layer communication uses two sockets, the source port and IP address, and the destination port and IP address, all of which together comprises a socket pair. CS 447 Chapter 3 Page 65

  10. DEMULTIPLEXING (CONNECTIONLESS) In connectionless Transport Layer service (e.g., UDP), sockets are created with port numbers that are local to the host. DatagramSocketserverSocketC = new DatagramSocket(6734) DatagramSocketclientSocketA = new DatagramSocket(8945) DatagramSocketclientSocketA = new DatagramSocket(9601) Process 1 Process 3 Process 2 Port 8945 Port 6734 Port 9601 response,etc. payload,etc. response,etc. payload,etc. 8945 9601 6734 6734 Note that IP datagrams with different source IP addresses and/or source port numbers may be directed to same socket. 9601 6734 8945 6734 CS 447 Chapter 3 Page 66

  11. DEMULTIPLEXING (CONNECTION-ORIENTED) In connection-oriented Transport Layer service (e.g., TCP), a receiving host uses all four values (the source and destination ports, and the source and destination IP addresses) to direct a segment to the appropriate socket. Process 1 Process 4 Process 5 Process 6 Process 2 Process 3 Port 7530 Port 8641 Port 9256 Port 4378 A server host may support several simultaneous TCP sockets (each socket identified by its own 4-tuple), and web servers have different sockets for each connecting client. W.X.Y.Z W.X.Y.Z W.X.Y.Z payload,etc. payload,etc. payload,etc. L.M.N.O E.F.G.H L.M.N.O 7530 9256 4378 8641 8641 8641 CS 447 Chapter 3 Page 67

  12. USER DATAGRAM PROTOCOL Source Port Destination Port Message Length Checksum UDP provides an unreliable delivery service using IP to transport messages between machines. As an unreliable service, it supports: • No acknowledgements, no timers, and no retransmissions • No flow control and no congestion control • Error recovery, using the same checksums as TCP The UDP Header Source Port Destination Port Message Length Checksum Source Port: Application’s UDP port number at the source station. Destination Port: Application’s UDP port number at the destination station. Message Length: # of bytes in the UDP datagram, including header and data. Checksum: 1’s complement of 1’s complement sum of all 16-bit words in header, data, & “pseudoheader”. An application using UDP accepts full responsibility for handling reliability, including: message loss, duplication, delay, out-of-order delivery, and loss of connectivity! CS 447 Chapter 3 Page 68

  13. UDP/TCP PSEUDOHEADER Source Address Destination Address 00000000 Protocol # Transport Segment Length Source Address Destination Address 00000000 Protocol # Transport Segment Length Source Address:IP address of the source station. Destination Address:IP address of the destination station. 00000000:Padding. Protocol Number:IP’s identification of the protocol type being used (i.e., 6 for TCP, 17 for UDP). Segment Length:Number of bytes in the Transport segment, including header and data. The Transport protocol uses the pseudoheader as part of its checksum calculation in order to verify both the source and destination sockets when the Transport segment is delivered. When the destination receives an IP datagram, IP passes the source and destination IP addresses, the datagram’s total length, and its protocol ID, to the Transport Layer, along with the Transport segment itself. The Transport protocol formulates the pseudoheader, and then calculates and checks the checksum. Note that the pseudoheader is not counted in the segment length (since it’s not part of the segment!) and is not transmitted! CS 447 Chapter 3 Page 69

  14. RELIABLE DATA TRANSFER A Transport protocol is considered reliable if it delivers all bits uncorrupted and in the correct order, regardless of how unreliable the underlying network is. CS 447 Chapter 3 Page 70

  15. FLOW CONTROL When an endstation transmits segments faster than the recipient can “digest” them, either due to a lack of memory capacity or a preoccupation with other tasks, the recipient will usually just discard the excess frames. The “Stop-and-Wait” approach to Transport Layer flow control has the recipient respond with an acknowledgement (ACK) whenever it has finished dealing with the previous transport segment and is ready to receive the next segment. Segment 6 Segment 1 Segment 2 Segment 3 Segment 9 Segment 6 Segment 8 Segment 8 Segment 7 Segment 6 Segment 0 Segment 8 ACK 3 ACK 2 ACK 1 NAK 6 ACK 6 NAK 6 ACK 9 ACK 7 ACK 8 ACK 4 ACK 2 ACK 5 ACK 1 Segment 0 Segment 4 Segment 1 Segment 5 Variations on this approach include: • “Piggybacking” ACKs on segments going the opposite direction on the link, in order to reduce channel utilization. • Sending negative acknowledgements (NAKs) whenever a segment is corrupted or not received in a timely fashion. • Retransmitting a segment automatically whenever an ACK is not received in a timely fashion. CS 447 Chapter 3 Page 71

  16. SLIDING WINDOWS By increasing the memory on each endstation and using a more sophisticated algorithm for keeping track of which Transport segments have and haven’t been accepted, traffic can flow more smoothly between the endstations. The “sliding windows” approach sets a particular window size for the total number of segments that the receiving station has either not received, not acknowledged, or not delivered to the current application. Every time the receiver transmits a segment to the sender, it includes a field advertising the number of slots in the window that are not occupied by segments that have been received and acknowledged, but not yet delivered. That number serves as a limit on how many more segments the sender can send to the receiver. Each segment is numbered with a “sequence number” so lost or duplicate segments can be determined, and the sequence numbers cycle back to zero to start repeating when the likelihood decreases that duplicate numbers will occur. CS 447 Chapter 3 Page 72

  17. ERROR CONTROL When a Transport segment is determined to be corrupted, there are two principal response alternatives. Go-Back-N Have the sending station resend the faulty segment and all subsequent segments. Selective Repeat Have the sending station resend only the segment that was faulty. ACK 6 NAK 3 ACK 2 NAK 0 Segment 3 Segment 0 Segment 1 Segment 2 Segment 3 Segment 4 Segment 5 Segment 5 Segment 3 Segment 1 Segment 6 Segment 7 Segment 0 Segment 1 Segment 0 Segment 2 Segment 4 ACK 7 NAK 0 NAK 3 ACK 5 ACK 2 Segment 4 Segment 3 Segment 1 Segment 5 Segment 2 Segment 3 Segment 6 Segment 0 Segment 7 Segment 0 Segment 1 Segment 2 Segment 0 Segment 3 • Simplifies processing on the endstations. • Yields a lot of unnecessary retransmissions. • More productive use of bandwidth. • More sophisticated (i.e., expensive) endstations. CS 447 Chapter 3 Page 73

  18. TRANSMISSION CONTROL PROTOCOL Source Port Destination Port Sequence Number Acknowledgement Number HdrLen Reserved Code Bits Window Size Checksum Urgent Pointer Options & Padding Source Port Destination Port To provide reliable Transport service, TCP must use a much more elaborate header than UDP. Sequence Number Acknowledgement Number HdrLen Reserved Code Bits Window Size Checksum Urgent Pointer Options & Padding Source Port: TCP port number of the application at the source station. Destination Port: TCP port number of the application at the destination station. Sequence Number: Position in the sender’s byte stream of this Transport segment. Acknowledgement Number: Sequence number of the next Transport segment expected from the destination. Header Length: Total length of the header (in 32-bit multiples). Reserved: Not currently used. Code Bits: 6 flags: URG (Is Urgent pointer field valid?), ACK (Is Ack. # Valid?), PSH (Push delivery w/o waiting for full buffer), RST (Reset connection), SYN (Synchronize sequence #s), FIN (End of sender’s byte stream) Window Size: Current sliding window size (in bytes) - for end-to-end flow control. Checksum: 1’s complement of 1’s complement sum of 16-bit words in header, data, & pseudoheader. Urgent Pointer: Position in the Transport segment where urgent data ends. Options & Padding: For example, Maximum-Segment-Size, Selective-Repeat, Delay-ACKs. CS 447 Chapter 3 Page 74

  19. TCP CONGESTION CONTROL Flow control deals with one pair of endstations adjusting transmission rates to accommodate the receiver’s capacity, but congestion control deals with a station’s perception that it might be contributing to an overall network traffic problem. How does a station “perceive” a congestion problem? ACK #527 ACK #527 ACK #527 Duplicate Acknowledgements While ACKs usually indicate that something is successfully getting through the network, duplicate ACK numbers indicate that the segment in question has been lost or corrupted. Acknowledgement Timeouts If no ACK is received in the required time, then it is unknown whether anything is getting through the network and a problem definitely exists. CS 447 Chapter 3 Page 75

  20. MULTIPLICATIVE DECREASE CONGESTION AVOIDANCE Since endstations cannot pinpoint the cause of perceived congestion problems, TCP dictates that they respond dramatically, as if they are the source of the problem. TCP handles this response by means of three values: • The maximum TCP segment size (mss) that the receiving endstation can accommodate. • The slow-start threshold (ssthresh) that prevents a station from recovering too quickly after it has perceived congestion. • The congestion window (cwnd) that limits how much unacknowledged traffic a station can have on the network. The standard TCP response to a perceived congestion problem is to have the endstation try to avoid contributing to the problem by setting ssthresh to ½cwnd and then resetting cwnd to mss. This prevents the station from having too many segments, without ACKs, and from returning to a high transmission rate, until the traffic problem has dissipated. old ssthresh new ssthresh old cwnd  new cwnd CS 447 Chapter 3 Page 76

  21. ADDITIVE INCREASE SLOW-START RECOVERY While TCP’s Congestion Avoidance scheme responds severely to bad news about congestion, TCP responds very cautiously to good news about successful transmissions. Whenever a positive ACK is received, the station increases cwnd by 1mss for each acknowledged segment until cwnd reaches ssthresh. To prevent a recurrence of the congestion problem, once cwnd reaches ssthresh, cwnd only increases by 1 mss for every passage of rtt milliseconds (where rtt is the estimated round-trip time for a segment to successfully travel across this connection to its destination and for an ACK to return). CS 447 Chapter 3 Page 77

More Related