Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
More on TCP Acknowledgements Sequence Number Field Initial Sequence Number Acknowledgement Number Field TCP • TCP is Reliable – IP packets carrying TCP segments may arrive out of order – TCP must put the TCP segments in order 5 3 4 2 1 TCP • TCP is Reliable – Each correct TCP segment is acknowledged by the receiver TCP Segment Source Transport Process Destination Transport Process ACK TCP Segment • 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 3? 1 4 2 5 TCP Sequence Numbers • TCP header has a 32-bit sequence number field Source Port # (16) Destination Port # (16) Sequence Number (32 bits) Acknowledgement Number (32 bits) Hdr Len Reserved (6) (4) Flags (6) TCP Checksum (16) Window Size (16) Urgent Pointer (16) Options (if any) Data Field PAD TCP Sequence Numbers • Initial Sequence Number is randomly selected by the sender; Say, 79 • Sent in the sequence number field of the first TCP segment TCP Header 79 TCP Data Field Sequence Number Field with Initial Sequence Number (79) TCP Sequence Numbers • Data octets in data fields of all segments in a connection are viewed as a long string ISN • TCP Segment 1 79 • TCP Segment 2 80 81 82 • TCP Segment 3 83 3 Octets in Data Field 2 Octets in Data Field 84 TCP Sequence Numbers • Supervisory segments, which contain a header but no data, are treated as carrying a single octet of data Carries data • TCP seg 1898 899 Supervisory segment • TCP seg 2900 • TCP seg 3901 Carries data 902 … TCP Sequence Numbers • Sequence number field gets the value of the first octet in the data field • TCP 1 79 79 is SeqNum Field Value • TCP 2 80 80 is SeqNum Field Value 81 82 83 is SeqNum Field Value • TCP 3 83 84 TCP Acknowledgements • Acknowledgement must indicate which TCP segment is being acknowledged TCP Segment Source TCP Process Destination TCP Process ACK TCP Acknowledgements • TCP header contains a 32-bit Acknowledgement Number field to designate the TCP segment being Source Port # (16) Destination Port # (16) acknowledged Sequence Number (32 bits) Acknowledgement Number (32 bits) Hdr Len Reserved (6) (4) Flags (6) TCP Checksum (16) Window Size (16) Urgent Pointer (16) Options (if any) Data Field PAD TCP Acknowledgment Numbers • Acknowledgement Number field contains the next byte expected--the last byte of the segment being acknowledged, plus one 80 is AckNum Field Value • TCP 1 79 • TCP 2 80 81 82 • TCP 3 83 84 83 is AckNum Field Value 85 is AckNum Field Value TCP Acknowledgement Number • Quiz: A TCP segment contains the following data octets – 567, 568, 569, 570, 571, 572, 573, 574 • What will be in the sequence number field of the TCP segment delivering the data? • What will be in the acknowledgement number field of the TCP segment acknowledging the TCP segment that delivers these octets? TCP Flow Control • Flow Control – – – – One TCP process transmits too fast Other TCP process is overwhelmed Receiver must control transmission rate This is flow control Too Much Data TCP Process TCP Process Flow Control Message TCP Flow Control • 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 Reserved (6) (4) Flags (6) TCP Checksum (16) Window Size (16) Urgent Pointer (16) Options (if any) Data Field PAD TCP Flow Control • A TCP segment has a Window Size field – Tell how many more octets the sender can send beyond the segment being acknowledged Data TCP Process TCP Process Acknowledgement with Window Size Field TCP Flow Control • 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 – Must then stop unless the window has been extended in another acknowledgement TCP Flow Control • Each Acknowledgement extends the window of octets that may be sent – Called a sliding window protocol 1-44 45-79 80-419 May send through 480 400 1-44 45-79 80-419 May send through 920 420-630 420-630 500 TCP Fragmentation • TCP Segments have maximum data field sizes – (Size limit details are discussed later) – What if an application layer message is too large? Application Layer Message TCP Data Field Max TCP Header TCP Fragmentation • Application layer message must be fragmented – Broken into several pieces – Delivered in separate TCP segments App Frag 1 App Frag 2 App Frag 3 TCP Data Field Max TCP Header TCP Fragmentation • Note that, in TCP fragmentation, the TCP segment is NOT fragmented – The application layer message is fragmented App Frag 1 App Frag 2 App Frag 3 TCP Data Field Max TCP Header TCP Fragmentation • 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 TCP Segment TCP Fragmentation • 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 Message TCP Segment TCP Segment Application Transport Internet TCP Fragmentation • What is the maximum TCP data field size? – Complex • Maximum Segment Size (MSS) – Maximum size of a TCP segment’s data field – NOT maximum size of the segment as its name would suggest!!! TCP Fragmentation • 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 TCP Fragmentation • 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 TCP Fragmentation • 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