1 / 24

TCP: A Closer Look

TCP: A Closer Look. Transmission Control Protocol. TCP: A Closer Look. Browser does not send HTTP Requests directly to the webserver application The application layer programs are not physically connected Browser sends HTTP Request to the user PC’s transport layer process for delivery.

Download Presentation

TCP: A Closer Look

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. TCP: A Closer Look Transmission Control Protocol

  2. TCP: A Closer Look • Browser does not send HTTP Requests directly to the webserver application • The application layer programs are not physically connected • Browser sends HTTP Request to the user PC’s transport layer process for delivery Browser HTTP Request Transport Process

  3. TCP: A Closer Look • Transport layer process stores the HTTP Request Temporarily Browser Transport Process Transport Process

  4. TCP: A Closer Look • User PC transport process opens a connection to the webserver transport layer process • This connection can be used to send several TCP segments to handle a each HTTP request-response cycle Browser Transport Process Transport Process

  5. TCP: A Closer Look • TCP has a Flags Field • Six one-bit flags TCP Segment Bit 0 Bit 31 Source Port # (16) Destination Port # (16) Sequence Number (32 bits) Acknowledgement Number (32 bits) Hdr Len (4) Reserved (6) Flags (6) Window Size (16) TCP Checksum (16) Urgent Pointer (16) Options (if any) PAD Data Field

  6. TCP/IP: A Closer Look • Three Flags are Widely Used • SYN bit set to 1 in a TCP segment to request a connection • ACK bit set to 1 in a segment to acknowledge a received TCP segment • FIN bit set to 1 in a segment to inform of a connection closure Hdr Len (4) Reserved (6) Flags (6) Window Size (16)

  7. TCP: A Closer Look • Opening a connection takes 3 Segments • Second TCP segment asks to open a connection and also acknowledges the first SYN message User PC Transport Process SYN Webserver Transport Process SYN, ACK ACK

  8. TCP: A Closer Look • Next, user PC sends the HTTP Request • Sends HTTP Request in data field of a TCP segment • Receives an ACK TCP segment to acknowledge receipt User PC Transport Process Webserver Transport Process TCP segment containing HTTP Request ACK

  9. Delivering the HTTP Response • Transport layer process on the webserver receives the TCP segment delivering the HTTP Request • The transport process on the webserver passes the HTTP Request in the TCP segment data field to the webserver application program Webserver Application HTTP Request Transport Process

  10. Delivering the HTTP Response • Webserver application creates the HTTP Response message • Webserver application passes the HTTP Response message to the webserver transport layer process for delivery to the user PC transport layer process Webserver Application HTTP Response Transport Process

  11. Delivering the HTTP Response • Webserver Transport Process Delivers the Response • User PC transport process sends an acknowledgement User PC Transport Process Webserver Transport Process TCP segment containing HTTP Response ACK

  12. TCP: A Closer Look • Multiple HTTP Request-Response Cycles can be Handled with a Single TCP Connection in HTTP/1.1 and later versions • Each will have the following: • TCP segment carrying the request • Acknowledgement of this segment • TCP segment carrying the response • Acknowledgement of response segment

  13. TCP: A Closer Look • Closing the Connection takes 4 TCP Segments • Initiated by the browser when it downloads the last file FIN User PC Transport Process Webserver Transport Process ACK FIN ACK

  14. TCP: A Closer Look • Refinement • ACKs have to be delivered quickly • Can be sent in TCP segments that carry only ACKs • However, if a data TCP segment is returned quickly, the ACK will be included with this segment • This segment will contain both new data and an acknowledgement of a previously received TCP segment • Reduces TCP segment transmissions

  15. TCP Connections: Recap • For EACH HTTP request-response cycle… • 3 TCP segments to open the connection • 2 TCP segments to send the HTTP request and get an acknowledgement for EACH request-response cycle • 2 TCP segments to send the HTTP response and get an acknowledgement for EACH request-response cycle • 4 TCP segments to close the connection • A very chatty protocol

  16. TCP: Error Handling • TCP is reliable--it does error correction • Each TCP segment has a sequence number that increases with each TCP segment a transport process sends TCP Segment Bit 0 Bit 31 Source Port # (16) Destination Port # (16) Sequence Number (32 bits)

  17. TCP: Error Handling • TCP is reliable--it does error correction • ACKs acknowledge a specific TCP segment in the sequence • If a TCP segment is not acknowledged, the other side retransmits it after awhile • This adds TCP segments beyond the ones we have seen

  18. TCP: Error Handling • TCP is reliable--it Places TCP Segments in Order • TCP segments are encapsulated in IP packets • IP does not guarantee that packets will arrive in order • TCP can place TCP segments in order based on their sequence numbers

  19. TCP: Error Handling • TCP Reliability in Perspective • Provides clean application data to application program • If data link layer frame or IP packet is lost at lower layers, receiving transport process will not acknowledge a segment • The sending transport process will resend automatically • So TCP protects against errors at lower layers as well as transport layer errors

  20. TCP: Why Connections? • Opens, closes, and ACKs create overhead, so undesirable • Why do it? • Allows sequence numbers, so that errors can be handled easily • Overall, TCP is a high-overhead, highly reliable transport layer protocol that catches any errors at lower layers, giving “clean” service to the application programs

  21. TCP: Refinements Mod A • Fragmentation • Transport process must fragments long application messages (break them into several pieces) and transmits them in several TCP segments • Each of these segments must be acknowledged separately • So when long files are downloaded in webservice, many more TCP segments will be generated than we discussed above

  22. TCP: Refinements Mod A • Flow Control • TCP implements flow control, so that one transport process will not overload its peer by transmitting too quickly

  23. User Datagram Protocol (UDP) • UDP • User Datagram Protocol • Alternative to TCP at the transport layer • Lightweight • No connections • No error correction • Reduces work source and destination host must do

  24. User Datagram Protocol (UDP) • UDP • Good for voice, for which the delay of error correction would be unacceptable • Good for applications for which the cost of an occasional message is small compared to the cost of connection-oriented service

More Related