Presentation is loading. Please wait.

Presentation is loading. Please wait.

More on TCP/IP Module A Copyright 2001 Prentice Hall.

Similar presentations


Presentation on theme: "More on TCP/IP Module A Copyright 2001 Prentice Hall."— Presentation transcript:

1 More on TCP/IP Module A Copyright 2001 Prentice Hall

2 A Closer Look at HTTP, TCP, IP, and PPP Chapter 3 Copyright 2001 Prentice Hall

3 3 A Closer Look at n HTTP at the Application Layer n TCP (and UDP) at the Transport Layer n IP at the Internet Layer n PPP at the Data Link Layer

4 A Closer Look at HTTP HyperText Transfer Protocol

5 5 HTTP: A Closer Look n World Wide Web Standards –HTML (HyperText Markup Language) governs the structure of the HTML webpage –HTTP (HyperText Transfer Protocol) governs the format and timing of requests and responses between the browser and the webserver application program Browser Webserver Program HTML HTTP

6 6 HTTP: A Closer Look n Sample HTTP Request Line –All text, often only a single line –Keyword absolute path HTTP/ version –Keyword (Method) is GET for Retrievals GET must be capitalized –Absolute path is URL without http://hostname GET /report1/home.htm HTTP/1.1 Absolute Path

7 7 HTTP: A Closer Look n Sample HTTP Request Header –Although the book only discusses the request- line, if only the absolute path is give, the request line is supposed to be followed by a header line naming the host. –So if the host is puka.hawaii.edu, the request- line and header would be (where CRLF is carriage return followed by line feed): GET /report1/home.htm HTTP/1.1[CRLF] Host:puka.hawaii.edu New

8 8 HTTP: A Closer Look n Sample HTTP Response Message –Header is multiple lines of text –Each ends with [CRLF] HTTP/1.1 200 OK[CRLF] Date: Tuesday, 20-JAN-1999 18:32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.

9 9 HTTP: A Closer Look n Sample HTTP Response Message –200 is a code for a successful retrieval, followed by the humanly readable code, OK HTTP/1.1 200 OK[CRLF] Date: Tuesday, 20-JAN-1999 18:32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.

10 10 HTTP: A Closer Look n Sample HTTP Response Message –There are other codes, indicating errors, such as 404 –Followed by a humanly readable code, such as, host not found HTTP/1.1 404 Host not Found[CRLF]

11 11 HTTP: A Closer Look n Sample HTTP Response Message –MIME-version and Content-type tell the type of file being retrieved –For HTML document, text/plain HTTP/1.1 200 OK[CRLF] Date: Tuesday, 20-JAN-1999 18:32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.

12 12 HTTP: A Closer Look n HTML Pages Contain Text –To be displayed n HTML Pages Contain Tags –Some tags say “place a graphic here”, “place a JAVA applet in a box here”, etc. –For instance, the tag says “Get file big.jpg and place it here in the HTML document” –Graphics, Java programs, etc. are separate files

13 13 HTTP: A Closer Look n Downloading a “page” may require several downloads –One for the HTML document –One each for the other files it calls for HTML Big. jpg App. java Webserver User PC File Downloads 2 3 1

14 14 HTTP: A Closer Look n Each download requires a separate HTTP request-response cycle! –So downloading complex webpages may require many HTTP request- response cycles HTML Big. jpg App. java Webserver User PC HTTP Request-Response Cycle 1 2 3

15 15 HTTP: A Closer Look n How Many HTTP messages will be created to download the three files? –3 HTTP request-response cycles –2 HTTP messages per cycle (request and response) –6 HTTP messages total HTML Big. jpg App. java Webserver User PC HTTP Request-Response Cycle 1 2 3

16 16 HTTP: A Closer Look n HTTP is Unreliable –There is no error detection and correction for transmission errors –This helps makes HTTP simple, allowing browsers and webserver application programs to be simple and inexpensive –So Unreliability can be good!

17 17 HTTP: A Closer Look n HTTP is Unreliable –As we will see later, TCP at the transport layer is reliable, offering error detection and correction –TCP gives HTTP clean data, so there is no need for HTTP to do error checking –Unreliability saves processing time on the source and destination hosts, reducing host costs –Unreliability makes browsers and webservers easier to write, reducing their costs

18 18 HTTP: A Closer Look n HTTP is Connectionless –Connection-oriented services establish a connection, maintain it for the duration of a communication, and then break the connection –For instance, in a telephone call, people say hello (agreeing to talk), note if the line goes dead, and agree to break the connection (we don’t simply hang up on the other person)

19 19 HTTP: A Closer Look n HTTP is Connectionless –Connectionless services merely send the message without a connection. Like sending a letter –HTTP is connectionless. Just send requests, get responses. No opens, maintenance, or closes Browser Webserver Application HTTP Request

20 20 HTTP: A Closer Look n HTTP is Connectionless –Connectionless operation is simple because of the lack of opens, maintenance, and closes –This makes HTTP simple, allowing browsers and webservers to be built easily Browser Webserver Application HTTP Request

21 TCP: A Closer Look Transmission Control Protocol

22 22 TCP: A Closer Look n 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

23 23 TCP: A Closer Look n Transport layer process stores the HTTP Request Temporarily –Does NOT merely add a TCP header and then pass the TCP segment down to the Internet layer process as noted in Chapter 2 Browser Transport Process Transport Process Request

24 24 TCP: A Closer Look n 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 several HTTP request-response cycles Browser Transport Process Transport Process

25 25 TCP: A Closer Look n 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

26 26 TCP/IP: A Closer Look n 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)

27 27 TCP: A Closer Look n Opening a connection takes 3 Segments –First TCP segment has SYN flag set. Requests connection to webserver transport process User PC Transport Process Webserver Transport Process SYN

28 28 TCP: A Closer Look n Opening a connection takes 3 Segments –Second TCP segment asks to open a connection and also acknowledges the first SYN message (ACK flag set too) User PC Transport Process Webserver Transport Process SYN SYN, ACK

29 29 TCP: A Closer Look n Opening a connection takes 3 Segments –Third TCP segment acknowledges the second –All segments are acknowledged except for pure ACKs like the third segment User PC Transport Process Webserver Transport Process SYN SYN, ACK ACK

30 30 TCP: A Closer Look n Next, user PC sends the HTTP Request –Sends HTTP Request in data field of a TCP segment –Will receive an ACK TCP segment to acknowledge receipt User PC Transport Process Webserver Transport Process TCP segment containing HTTP Request ACK

31 31 Delivering the HTTP Response n 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

32 32 Delivering the HTTP Response n 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

33 33 Delivering the HTTP Response n 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

34 34 TCP: A Closer Look n Multiple HTTP Request-Response Cycles can be Handled with a Single TCP Connection in HTTP/1.1 and later versions –Request message must have Connection: Keep-Alive n Each will have the following: –TCP segment carrying the HTTP request –Acknowledgement of this segment –TCP segment carrying the HTTP response –Acknowledgement of response segment

35 35 TCP: A Closer Look n 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

36 36 TCP: A Closer Look n Refinement –If you respond quickly to a letter, often include acknowledgement of letter you received in your response letter –TCP segments can send new information and acknowledge a segment received Ex. SYN, ACK at start of connection –If response will take time, however, send a pure ACK message

37 37 TCP Connections: Recap n For EACH Page Download… –3 TCP segments to open the connection –4 TCP segments per file downloaded More if file downloaded is long, because may take multiple segments to download –4 TCP segments to close the connection –A very chatty protocol

38 38 TCP: Error Handling n TCP is reliable--it does error correction –Each TCP segment has a 32-bit 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

39 39 TCP: Error Handling n 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

40 40 TCP: Error Handling n 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

41 41 TCP: Error Handling n 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

42 42 TCP: Why Connections? n Opens, closes, and ACKs create overhead, so undesirable n Why do it? –Allows sequence numbers, so that errors can be handled easily n 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

43 43 TCP: Refinements n Fragmentation –Transport process must fragment long application messages (break them into several pieces) and transmits them in several TCP segments –So when large files are downloaded in webservice, many more TCP segments will be generated than we discussed above Mod A App Frag 2TCP-HApp Frag 1TCP-H

44 44 TCP: Refinements n Flow Control –TCP implements flow control, so that one transport process will not overload its peer by transmitting too quickly Mod A User PC Transport Process Webserver Transport Process Data ACK Command to Limit Speed

45 45 User Datagram Protocol (UDP) n UDP –User Datagram Protocol –Alternative to TCP at the transport layer –Lightweight No connections (connectionless) No error correction (unreliable) Reduces work source and destination host must do

46 46 User Datagram Protocol (UDP) n 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

47 More on TCP Acknowledgements Sequence Number Field Initial Sequence Number Acknowledgement Number Field

48 48 TCP n TCP is Reliable –IP packets carrying TCP segments may arrive out of order –TCP must put the TCP segments in order 34215

49 49 TCP n TCP is Reliable –Each correct TCP segment is acknowledged by the receiver Source Transport Process Source Transport Process Destination Transport Process Destination Transport Process TCP Segment ACK

50 50 TCP Segment n Each TCP segment sent by a side must have a sequence number –Simplest: 1,2,3,4,5,6,7 –To detect lost or out-of-sequence messages –TCP uses a more complex approach 1 1 4 4 2 2 5 5 3?

51 51 TCP Sequence Numbers n TCP header has a 32-bit sequence number field to identify a TCP segment’s position in a series of segments 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 Reserved (6) TCP Checksum (16)Urgent Pointer (16) Data Field

52 52 TCP Sequence Numbers n Initial Sequence Number is randomly selected by the sender; Say, 79 n Sent in the sequence number field of the first TCP segment 79 TCP Data Field TCP Header Sequence Number Field with Initial Sequence Number (79)

53 53 TCP Sequence Numbers n Data octets in data fields of all segments in a connection are viewed as a long string n TCP Segment 179 n TCP Segment 280 81 82 n TCP Segment 383 84 3 Octets in Data Field 2 Octets in Data Field ISN

54 54 TCP Sequence Numbers n Supervisory segments, which contain a header but no data, are treated as carrying a single octet of data n TCP seg 1898 899 n TCP seg 2900 n TCP seg 3901 902 … Supervisory segment Carries data

55 55 TCP Sequence Numbers n Sequence number field gets the value of the first octet in the data field n TCP 179 n TCP 280 81 82 n TCP 383 84 80 is SeqNum Field Value 83 is SeqNum Field Value 79 is SeqNum Field Value

56 56 TCP Acknowledgements n Acknowledgement must indicate which TCP segment is being acknowledged Source TCP Process Source TCP Process Destination TCP Process Destination TCP Process TCP Segment ACK

57 57 TCP Acknowledgements n TCP header contains a 32-bit Acknowledgement Number field to designate the TCP segment being acknowledged 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 Reserved (6) TCP Checksum (16)Urgent Pointer (16) Data Field

58 58 TCP Acknowledgment Numbers n Acknowledgement Number field contains the next byte expected--the last byte of the segment being acknowledged, plus one n TCP 179 n TCP 280 81 82 n TCP 383 84 83 is AckNum Field Value 85 is AckNum Field Value 80 is AckNum Field Value

59 59 TCP Acknowledgement Number n Quiz: A TCP segment contains the following data octets –567, 568, 569, 570, 571, 572, 573, 574 n What will be in the sequence number field of the TCP segment delivering the data? n What will be in the acknowledgement number field of the TCP segment acknowledging the TCP segment that delivers these octets?

60 60 TCP Flow Control n Flow Control –One TCP process transmits too fast –Other TCP process is overwhelmed –Receiver must control transmission rate –This is flow control TCP Process Too Much Data Flow Control Message

61 61 TCP Flow Control n A TCP segment has a Window Size field –Used in acknowledgements 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 Reserved (6) TCP Checksum (16)Urgent Pointer (16) Data Field

62 62 TCP Flow Control n A TCP segment has a Window Size field –Tell how many more octets the sender can send beyond the segment being acknowledged TCP Process Data Acknowledgement with Window Size Field

63 63 TCP Flow Control n Example –TCP segment contained octets 45-89 –Acknowledgement number for TCP segment acknowledging the segment is 90 –If Window Size field value is 50, then –Sender may send through octet 140 (90 plus 50) –Must stop before 50 unless the window is extended in another acknowledgement

64 64 TCP Flow Control n Each Acknowledgement extends the window of octets that may be sent –Called a sliding window protocol 1-4445-7980-419420-630 400 May send through 480 1-4445-7980-419420-630 500 May send through 920

65 65 TCP Fragmentation n TCP Segments have maximum data field sizes –(Size limit details are discussed later) –What if an application layer message is too large? TCP HeaderTCP Data Field Max Application Layer Message

66 66 TCP Fragmentation n Application layer message must be fragmented –Broken into several pieces –Delivered in separate TCP segments TCP HeaderTCP Data Field Max App Frag 1App Frag 2App Frag 3

67 67 TCP Fragmentation n Note that, in TCP fragmentation, the TCP segment is NOT fragmented –The application layer message is fragmented TCP HeaderTCP Data Field Max App Frag 1App Frag 2App Frag 3

68 68 TCP Fragmentation n Transport layer process on the source host does the fragmentation –Application layer on the source host is not involved –Transparent to the application layer Application Transport Internet Application Message TCP Segment

69 69 TCP Fragmentation n Transport layer process on the destination host does the reassembly –Application layer on the destination host is not involved; Gets original application layer message Application Transport Internet Application Message TCP Segment

70 70 TCP Fragmentation n What is the maximum TCP data field size? –Complex n Maximum Segment Size (MSS) –Maximum size of a TCP segment’s data field –NOT maximum size of the segment as its name would suggest!!!

71 71 TCP Fragmentation n MSS Default is 536 octets –Minimum IP packet size any network must support is 576 octets Larger IP packets MAY be fragmented –IP and TCP headers are 20 octets each if there are no options –This gives the default MSS of 536 –Smaller if there are options in the IP or TCP header

72 72 TCP Fragmentation n MSS Default is 536 octets –Suppose the application layer process is 1,000 octets long –Two TCP segments will be needed to send the data –The first can send the first 536 octets –The second can carry the remaining 464 octets of the application layer message

73 73 TCP Fragmentation n Each side MAY announce a larger MSS –An option usually used in the initial SYN message it sends to the other –If announces MSS of 2,048, this many octets of data may be sent in each TCP segments –536 is only the default—the value to use if no other value is specified by the other side

74 More on Internet Layer Processes

75 75 Mask Operations n Masks were introduced in Chapter 3 n IP addresses alone do not tell you the size of their network or subnet parts n Network Mask –Has 1s in the network part –Has 0s in the remaining bits n Subnet Mask –Has 1s in the network plus subnet parts –Has 0s in the remaining bits

76 76 Multiplexing n IP packets can carry different things in their data fields –TCP segments –UDP datagrams –ICMP supervisory messages (later) –RIP messages (later) IP Data FieldIP Header

77 77 Multiplexing n We say that IP can multiplex (mix) different types of traffic in a stream of IP packets UDPIP-HTCPIP-HUDPIP-HICMPIP-H Stream of Arriving or Outgoing IP Packets Single IP Packet Carrying UDP Datagram

78 78 Multiplexing n IP process must pass contents of arriving IP packets to the correct process for subsequent handling IP TCPUDP ICMP UDPIP-H IP Process Arriving Packets

79 79 Multiplexing n IP process must also accept messages from multiple processes and multiplex them on an outgoing stream IP TCPUDP ICMP UDPIP-H IP Process Outgoing Packets


Download ppt "More on TCP/IP Module A Copyright 2001 Prentice Hall."

Similar presentations


Ads by Google