Published on

Published in: Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • This chapter will examine the role of the Transport layer in encapsulating application data for use by the Network layer.
  • Consider a computer connected to a network that is simultaneously receiving and sending e-mail and instant messages, viewing websites, and conducting a VoIP phone call.
  • What applications need reliability?
  • The two most common Transport layer protocols of TCP/IP protocol suite are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). Both protocols manage the communication of multiple applications.
  • The key distinction between TCP and UDP is reliability.
  • Within the TCP segment header, there are six 1-bit fields that contain control information used to manage the TCP processes. Each of these fields is only 1 bit and, therefore, has only two values: 1 or 0. When a bit value is set to 1, it indicates what control information is contained in the segment. SYN  bit is used in establishing a TCP connection to synchronize the sequence numbers between both endpoints. ACK  bit is used to acknowledge the remote host’s sequence numbers, declaring that the information in the acknowledgment field is valid. PSH  flag is set on the sending side, and tells the TCP stack to flush all buffers and send any outstanding data up to and including the data that had the PSH flag set. When the receiving TCP sees the PSH flag, it too must flush its buffers and pass the information up to the application. URG  bit indicates that the urgent pointer field has a valid pointer to data that should be treated urgently and be transmitted before non-urgent data. RST  bit tells the receiving TCP stack to immediately abort the connection. FIN  bit is used to indicate that the client will send no more data (but will continue to listen for data).
  • 1. Syn = Prev Syn+1; 2. Ack = Rx Syn+1;
  • In the above example, the initial window size for a TCP session represented is set to 3000 bytes. When the sender has transmitted 3000 bytes, it waits for an acknowledgement of these bytes before transmitting more segments in this session. Once the sender has received this acknowledgement from the receiver, the sender can transmit an additional 3000 bytes.
  • Another way to control the data flow is to use dynamic window sizes.
  • Chapter4

    1. 1. Ch 4 - Chapter 4 OSI Transport Layer
    2. 2. Objectives <ul><li>Explain the need for the Transport layer </li></ul><ul><li>Identify the role of the Transport layer as it provides the end-to-end transfer of data between applications </li></ul><ul><li>Describe the role of the two TCP/IP Transport layer protocols: TCP and UDP </li></ul><ul><li>Explain the key functions of the Transport layer, including reliability , port addressing and segmentation </li></ul><ul><li>Explain how TCP and UDP each handle key functions </li></ul><ul><li>Identify when it is appropriate to use TCP or UDP and provide examples of applications that use each protocol </li></ul>Ch 4 -
    3. 3. Role of the Transport Layer <ul><li>Enables multiple applications to communicate over the network at the same time on a single device </li></ul><ul><li>Ensures that all data is received reliably and in order by the correct application </li></ul><ul><li>Employs error handling mechanism </li></ul>Ch 4 -
    4. 4. Transport Layer Functions <ul><li>Tracking the individual communication between applications on the source and destination hosts </li></ul><ul><ul><li>any host may have multiple applications that are communicating over the network </li></ul></ul><ul><ul><li>responsibility of the Transport layer to maintain the multiple communication streams between these applications </li></ul></ul><ul><li>Segmenting the application data and managing each segment </li></ul><ul><ul><li>the data stream must be prepared to sent in manageable pieces </li></ul></ul><ul><ul><li>segments the application data and encapsulates each segment with a header to indicate which communication it is associated </li></ul></ul><ul><li>Reassembling the segments into streams of application data </li></ul><ul><ul><li>each segment is directed to the appropriate application and reconstructed into a complete data stream </li></ul></ul>Ch 4 -
    5. 5. Transport Layer Functions (cont’d) <ul><li>Identifying the different applications </li></ul><ul><ul><li>the Transport layer assigns an application an identifier , called the port number , to indicate which application that segment is associated </li></ul></ul>Ch 4 -
    6. 6. Separating Multiple Communications <ul><li>The Transport layer segments the data and manages the separation of data for different applications </li></ul><ul><ul><li>multiple applications running on a device receive the correct data </li></ul></ul><ul><ul><li>data from the phone call is not directed to the web browser </li></ul></ul>Ch 4 -
    7. 7. Managing Information <ul><li>E-mail and web page </li></ul><ul><ul><li>information must be completely received and presented to be considered useful </li></ul></ul><ul><ul><li>slight delays are considered acceptable in order that complete information is received and presented </li></ul></ul><ul><ul><li>network manages the resending of missing segments </li></ul></ul><ul><li>Telephone conversation </li></ul><ul><ul><li>missing parts of a conversation may be considered acceptable </li></ul></ul><ul><ul><li>infer the missing audio from the context of the conversation </li></ul></ul><ul><ul><li>ask the opposite party to repeat </li></ul></ul><ul><ul><li>user manages the resending of missing information </li></ul></ul>Ch 4 -
    8. 8. Segmentation <ul><li>Dividing data into small parts, and sending these parts from source to destination, enables may different applications to be interleaved (or multiplexed ) on the same network </li></ul><ul><ul><li>makes error recovery and retransmission of damaged data easier </li></ul></ul><ul><ul><li>without segmentation, only one application would be able to receive data </li></ul></ul>Ch 4 - <ul><ul><li>each of these applications is a conversation </li></ul></ul><ul><li>Transport layer adds a header containing binary data to identify each segment of data </li></ul>
    9. 9. Controlling the Conversations <ul><li>Segmentation and re-assembly </li></ul><ul><ul><li>at the source, the Transport layer divides the application data into smaller blocks because there is a limit on the amount of data in a single PDU </li></ul></ul><ul><ul><li>at the destination, the Transport layer re-assembles the PDUs </li></ul></ul>Ch 4 - <ul><li>Conversation multiplexing </li></ul><ul><ul><li>each application is assigned and identified by a port number </li></ul></ul>
    10. 10. Controlling the Conversations (cont’d) <ul><li>Connection-oriented conversations </li></ul><ul><ul><li>establishes a session between the applications </li></ul></ul><ul><ul><li>ensures the application is ready to receive the data </li></ul></ul><ul><li>Reliable delivery </li></ul><ul><ul><li>lost segments are re-sent so that the data is received complete </li></ul></ul><ul><li>Ordered data reconstruction </li></ul><ul><ul><li>numbering and sequencing the segments to ensure they are reassembled into the proper order </li></ul></ul><ul><li>Flow control </li></ul><ul><ul><li>regulating the rate of data flow to prevent the loss of segments and avoid the need for re-transmission </li></ul></ul>Ch 4 -
    11. 11. Reliable Communication <ul><li>Reliable delivery of data ensures that each piece of data the source sends arrives at the destination </li></ul><ul><ul><li>keep track of all data pieces transmitted </li></ul></ul><ul><ul><li>acknowledge the receipt of the data by the destination </li></ul></ul><ul><ul><li>retransmit any unacknowledged data </li></ul></ul><ul><li>These reliability processes place additional overhead on the network resources due to the tracking, acknowledgement and retransmission </li></ul><ul><ul><li>control information is contained in the Transport header </li></ul></ul><ul><ul><li>trade-off between the choice of reliability and the burden it places on the network </li></ul></ul>Ch 4 -
    12. 12. Determining The Need For Reliability <ul><li>Applications, such as web pages, e-mails and databases , are designed to use a Transport layer that implements reliability </li></ul><ul><ul><li>missing data could cause a corrupt communication </li></ul></ul>Ch 4 - <ul><li>Other applications, such as voice and video , are more tolerant to the loss of small amounts of data </li></ul><ul><ul><li>missing segments would only create a momentary disruption in the data stream </li></ul></ul>
    13. 13. Transmission Control Protocol <ul><li>TCP is a connection-oriented (CO) and reliable protocol, RFC 793 </li></ul><ul><ul><li>guaranteed delivery </li></ul></ul><ul><li>Each TCP segment uses a 20-byte header </li></ul>Ch 4 -
    14. 14. User Datagram Protocol <ul><li>UDP is a connectionless (CL) and unreliable protocol, RFC768 </li></ul><ul><ul><li>best-effort delivery </li></ul></ul><ul><ul><li>does not provide retransmission, sequencing and flow control </li></ul></ul><ul><li>Each UDP datagram uses 8 bytes of overhead in the header </li></ul><ul><li>UDP is a simpler design and generates less overhead than TCP, resulting in a faster transfer of data </li></ul><ul><li>Datagram may not arrive in the order in which it was sent </li></ul>Ch 4 -
    15. 15. Port Addressing <ul><li>TCP and UDP use unique port numbers in the header fields to keep track of the various applications </li></ul><ul><ul><li>source and destination ports </li></ul></ul><ul><ul><li>source port number in a client request is a randomly generated number </li></ul></ul>Ch 4 - <ul><ul><li>destination port number is a default or manually assigned number </li></ul></ul><ul><li>A socket is a combination of the Transport layer port number and Network layer IP address </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul>
    16. 16. Port Numbers <ul><li>Port numbers are assigned by the Internet Assigned Numbers Authority ( IANA ) </li></ul><ul><li>Well known ports: 0 to 1023 </li></ul><ul><ul><li>commonly used for server applications </li></ul></ul><ul><li>Registered ports: 1024 to 49151 </li></ul><ul><ul><li>assigned to user processes or applications </li></ul></ul><ul><li>Dynamic or private ports: 49152 to 65535 </li></ul><ul><ul><li>assigned dynamically to client applications when initiating a connection </li></ul></ul>Ch 4 -
    17. 17. TCP and UDP Port Numbers Ch 4 -
    18. 18. TCP/UDP Common Ports Ch 4 -
    19. 19. Netsat <ul><li>A network utility used to verify the connections </li></ul><ul><ul><li>lists the protocol in use, the local address and port number, the foreign address and port number, and the state of the connection </li></ul></ul><ul><li>Can be used to examine open connections on a host when performance appears to be compromised </li></ul><ul><ul><li>unexplained TCP connections can pose a major security threat </li></ul></ul>Ch 4 - protocol used source port address or name of remote host destination port connection state
    20. 20. Segmentation and Reassembly <ul><li>The Transport layer divides the data into pieces and adds a header </li></ul><ul><ul><li>ensures that data is transmitted within the limits of the media </li></ul></ul><ul><ul><li>data from different application can be multiplexed on to the media </li></ul></ul>Ch 4 -
    21. 21. Reliable TCP Conversations <ul><li>Connection-oriented (CO) session </li></ul><ul><ul><li>establishment of a session between the hosts in both directions </li></ul></ul><ul><ul><li>connection enables the tracking of a session </li></ul></ul><ul><li>Acknowledgements </li></ul><ul><ul><li>destination sends acknowledgements to the source for the segments that it receives </li></ul></ul><ul><ul><li>source keeps track of which segments are awaiting acknowledgement </li></ul></ul><ul><ul><li>if the source does not receive an acknowledgement within a predetermined amount of time, it retransmits that data to the destination </li></ul></ul><ul><li>The reliability is achieved by having fields in the TCP header </li></ul>Ch 4 -
    22. 22. TCP Header Fields <ul><li>Source port </li></ul><ul><ul><li>TCP session on the device that opened a connection – normally a random value above 1023 </li></ul></ul><ul><li>Destination port </li></ul><ul><ul><li>identifies the upper layer protocol or application on remote site </li></ul></ul><ul><li>Sequence number </li></ul><ul><ul><li>indentifies the sequence of each transmitted segment </li></ul></ul><ul><li>Acknowledgement number </li></ul><ul><ul><li>contains the value of the next sequence number the receiver is expecting to receive </li></ul></ul><ul><li>Header length </li></ul><ul><ul><li>specifies the size of the TCP header </li></ul></ul>Ch 4 -
    23. 23. TCP Header Fields (cont’d) <ul><li>Flags (URG, ACK, PSH, RST, SYN, FIN) </li></ul><ul><ul><li>used in session management and in the treatment of the segments </li></ul></ul><ul><ul><li>the value of each flag is either a 1 or 0 </li></ul></ul><ul><ul><li>1 indicates that control information is contained in the segment </li></ul></ul><ul><li>Window size => Flow Control </li></ul><ul><ul><li>determines the number of bytes that can be sent before an acknowledgement from the receiver is necessary </li></ul></ul><ul><li>Checksum </li></ul><ul><ul><li>used for error-checking of the header and data </li></ul></ul><ul><li>Urgent pointer </li></ul><ul><ul><li>only used with URG flag and points to the sequence number of the last byte in a sequence of urgent data </li></ul></ul>Ch 4 -
    24. 24. TCP Server Processes <ul><li>A client initiates a communication with a request for information or other services using a random port number as the source port </li></ul><ul><li>Each application process running on the server is configured to use an unique port number </li></ul>Ch 4 -
    25. 25. TCP Connection Establishment <ul><li>The hosts perform a three-way handshake to establish a connection </li></ul><ul><ul><li>the initiating client sends a segment containing an initial sequence number ( SYN = Pre SEQ +1 ; ACK = Rx SEQ + 1 ) </li></ul></ul><ul><ul><li>the server responds with a segment containing an acknowledgement and its own synchronizing sequence number </li></ul></ul><ul><ul><li>the initiating client responds with an acknowledgement </li></ul></ul>Ch 4 -
    26. 26. Three-Way Handshake (SYN) <ul><li>SYN flag set to validate an Initial Sequence Number (ISN) </li></ul><ul><li>Relative sequence number is 0 </li></ul><ul><li>Random source port is 1069 </li></ul><ul><li>Well-know destination port is 80 (http) </li></ul>Ch 4 -
    27. 27. Three-Way Handshake (SYN, ACK) <ul><li>ACK flag set to indicate a valid Acknowledgement number </li></ul><ul><li>Acknowledgement number response to ISN as relative value of 1 </li></ul><ul><li>SYN flag set to indicate ISN for server to client session </li></ul><ul><li>Source port of 80 and destination port of 1069 </li></ul>Ch 4 -
    28. 28. Three-Way Handshake (ACK) <ul><li>ACK flag set to indicate a valid Acknowledgement number </li></ul><ul><li>Acknowledgement number response to ISN as relative value of 1 </li></ul><ul><li>Source port is 1069 and destination port is 80 (http) </li></ul>Ch 4 -
    29. 29. TCP Connection Termination <ul><li>The session termination involves a four-step process </li></ul><ul><ul><li>when the client has no more data to send, it sends a segment with the FIN flag set </li></ul></ul><ul><ul><li>the server responds with an ACK to acknowledge receipt of the FIN to terminate the session </li></ul></ul><ul><ul><li>the server sends a FIN to the client to terminate the session </li></ul></ul>Ch 4 - <ul><ul><li>the client responds with an ACK to acknowledge the FIN request from the server </li></ul></ul>
    30. 30. Termination (FIN) <ul><li>Server sets FIN flag to indicate a session termination </li></ul><ul><li>Server sequence number is 440 </li></ul>Ch 4 -
    31. 31. Termination (ACK) <ul><li>ACK flag set to indicate a valid Acknowledgement number </li></ul><ul><li>Acknowledgement number response to ISN as relative value of 441 </li></ul><ul><li>Source port is 1069 and destination port is 80 (http) </li></ul>Ch 4 -
    32. 32. TCP Reassembly <ul><li>The segments may arrive out of order at the destination </li></ul><ul><li>The sequence number in the TCP header enables each segment to be uniquely identified and acknowledged </li></ul><ul><ul><li>how to reassemble and reorder received segments </li></ul></ul>Ch 4 - <ul><li>Any segments that arrive with non-contiguous numbers are held for later processing </li></ul><ul><ul><li>when the missing segments arrive, they are processed </li></ul></ul>
    33. 33. TCP Acknowledgement and Windowing <ul><li>The sequence number and acknowledgement number are used together to confirm receipt of the segments </li></ul><ul><li>The acknowledgement number in the segment sent back to the source indicates the next segment the receiver expects to receive </li></ul>Ch 4 - <ul><li>The amount of data that a source can transmit before an acknowledgement must be received is called the window size </li></ul><ul><ul><li>this technique is known as windowing </li></ul></ul><ul><ul><li>reduce the overhead of the acknowledgements </li></ul></ul>
    34. 34. TCP Retransmission <ul><li>TCP provides a mechanism to retransmit unacknowledged segments </li></ul><ul><ul><li>source device retransmits data from the last acknowledgement when it does not receive an acknowledgement after timeout </li></ul></ul><ul><li>Destination device usually acknowledges contiguous segments that complete the stream </li></ul>Ch 4 - <ul><li>Selective Acknowledgements allow a destination to acknowledge discontinuous segments and the host would only need to retransmit the missing data </li></ul>
    35. 35. TCP Flow Control <ul><li>Flow control adjusts the effective rate of data flow the network and destination device can support without loss </li></ul><ul><ul><li>prevents the data from the source to overwhelm the destination </li></ul></ul><ul><li>When the source receives an acknowledgement for the specified amount of transmitted segments, it can continue sending more data </li></ul>Ch 4 -
    36. 36. Flow Control (cont’d) <ul><li>The window size field specifies the number of bytes sent before an acknowledgement is expected </li></ul><ul><ul><li>an initial window size is determined during the session startup via the three-way handshake </li></ul></ul><ul><ul><li>the acknowledgement number is the number of the next expected byte </li></ul></ul><ul><li>TCP attempts to manage the rate of transmission so that all data will be received and retransmissions are minimized </li></ul>Ch 4 -
    37. 37. Dynamic Window Size <ul><li>The initial window size is determined during the session setup </li></ul><ul><li>If segments are lost because of congestion or limited buffer memory, the receiver will acknowledge the last received sequential segment and reply with a reduced window size </li></ul><ul><ul><li>effectively slows down the rate of transmission </li></ul></ul>Ch 4 -
    38. 38. Dynamic Window Size (cont’d) <ul><li>After periods of transmission with no data losses or constrained resources, the receiver will begin to increase the window field </li></ul><ul><ul><li>fewer acknowledgements need to be sent </li></ul></ul><ul><ul><li>window size will continue to increase until there is data loss , which will cause the window size to decrease </li></ul></ul><ul><li>The dynamic increasing and decreasing of window size is a continuous process in TCP to determine the optimum window size </li></ul>Ch 4 -
    39. 39. UDP Datagram Reassembly <ul><li>Datagrams may take different paths to a destination and may arrive in the wrong order </li></ul><ul><li>UDP does not keep track of sequences numbers </li></ul><ul><ul><li>no way to reorder the datagrams into the transmission order </li></ul></ul>Ch 4 - <ul><ul><li>simply reassembles the data in the order that it was received and forwards it to the application </li></ul></ul><ul><li>The application identifies the proper sequence and determines how the data should be processed </li></ul>
    40. 40. UDP Server Processes and Requests <ul><li>UDP-based servers are assigned well-known or registered port numbers </li></ul><ul><li>UDP server listens for client request, as shown in the figure </li></ul><ul><ul><li>client requests use well-known port numbers as the destination port </li></ul></ul><ul><ul><li>forwards the application data based on its port number </li></ul></ul>Ch 4 -
    41. 41. UDP Client Processes <ul><li>Clients requests to UDP server use random port numbers as the source port </li></ul><ul><li>Server response to UDP clients use random port numbers as the destination port </li></ul>Ch 4 -