Download presentation
Presentation is loading. Please wait.
Published byBeverley Dickerson Modified over 9 years ago
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 Transport Process HTTP Request
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 Source Port # (16)Destination Port # (16) Sequence Number (32 bits) Acknowledgement Number (32 bits) Hdr Len (4) Flags (6)Window Size (16) Options (if any)PAD Bit 0Bit 31 Reserved (6) TCP Checksum (16)Urgent Pointer (16) TCP Segment 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) Flags (6)Window Size (16)Reserved (6)
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 Webserver Transport Process SYN 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 Transport Process HTTP Request
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 Transport Process HTTP Response
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 User PC Transport Process Webserver Transport Process 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: A Closer Look In human terms, consider a phone call to understand connection-oriented service –One person initiates the call –The second person acknowledges the first person’s by saying “hello.” This also indicates that they are available to talk –The first person acknowledges the second person’s availability by talking –Then talk back and forth –Then mutually agree to stop
16
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
17
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 Source Port # (16)Destination Port # (16) Sequence Number (32 bits) Bit 0Bit 31 TCP Segment
18
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
19
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
20
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
21
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
22
TCP: Refinements 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 Mod A
23
TCP: Refinements Flow Control –TCP implements flow control, so that one transport process will not overload its peer by transmitting too quickly Mod A
24
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
25
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.