Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson
TCP is reliable. ◦ IP packets carrying TCP segments may arrive out of order. ◦ TCP must put the TCP segments in order © 2013 Pearson
TCP is reliable. ◦ Each correct TCP segment is acknowledged by the receiver. 3 Source Transport Process Source Transport Process Destination Transport Process Destination Transport Process TCP Segment ACK © 2013 Pearson
Each TCP segment sent by a side must have a sequence number. ◦ Simplest approach to sequence numbers: 1,2,3,4,5,6,7, and so on ◦ To detect lost or out-of-sequence messages ◦ (TCP uses a more complex approach than this, as we will see) ? © 2013 Pearson
TCP header has a 32-bit sequence number field. 5 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 © 2013 Pearson
Initial Sequence Number is randomly selected by the sender; say, 79. Sent in the sequence number field of the first TCP segment TCP Data Field TCP Header Sequence Number Field with Initial Sequence Number (79) © 2013 Pearson
Data octets in data fields of all segments in a connection are viewed as a long string. TCP Segment 179 TCP Segment TCP Segment Octets in Data Field 2 Octets in Data Field ISN © 2013 Pearson
Supervisory segments, which contain a header but no data, are treated as carrying a single octet of data. TCP seg TCP seg 2900 TCP seg … 8 Supervisory Segment Carries Data © 2013 Pearson
Sequence number field gets the value of the first octet in the data field. TCP 179 TCP TCP is SeqNum Field Value 83 is SeqNum Field Value 79 is SeqNum Field Value © 2013 Pearson
Acknowledgement must indicate which TCP segment is being acknowledged. 10 Source TCP Process Source TCP Process Destination TCP Process Destination TCP Process TCP Segment ACK © 2013 Pearson
TCP header contains a 32-bit Acknowledgement Number field to designate the TCP segment being acknowledged. 11 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 © 2013 Pearson
Acknowledgement Number field contains the next byte expected—the last byte of the segment being acknowledged, plus one. TCP 179 TCP TCP is AckNum Field Value 85 is AckNum Field Value 80 is AckNum Field Value © 2013 Pearson
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? 13 © 2013 Pearson
Flow Control ◦ One TCP process transmits too fast. ◦ Other TCP process is overwhelmed. ◦ Receiver must control transmission rate. ◦ This is flow control. 14 TCP Process Too Much Data Flow Control Message © 2013 Pearson
A TCP segment has a Window Size field. ◦ Used in acknowledgements 15 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 © 2013 Pearson
A TCP segment has a Window Size field. ◦ Tell how many more octets the sender can send beyond the segment being acknowledged 16 TCP Process Data Acknowledgement with Window Size Field © 2013 Pearson
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 17 © 2013 Pearson
Each Acknowledgement extends the window of octets that may be sent. ◦ Called a sliding window protocol 18 1–4445 – 7980 – – May send through – 4445 – 7980 – – May send through 920 © 2013 Pearson
TCP Segments have maximum data field sizes. ◦ (Size limit details are discussed later.) ◦ What if an application layer message is too large? 19 TCP HeaderTCP Data Field Max Application Layer Message © 2013 Pearson
Application layer message must be fragmented. ◦ Broken into several pieces ◦ Delivered in separate TCP segments 20 TCP HeaderTCP Data Field Max App Frag 1App Frag 2App Frag 3 © 2013 Pearson
Note that, in TCP fragmentation, the TCP segment is not fragmented. ◦ The application layer message is fragmented. 21 TCP HeaderTCP Data Field Max App Frag 1App Frag 2App Frag 3 © 2013 Pearson
Transport layer process on the source host does the fragmentation. ◦ Application layer on the source host is not involved ◦ Transparent to the application layer 22 Application Transport Internet Application Message TCP Segment © 2013 Pearson
Transport layer process on the destination host does the reassembly. ◦ Application layer on the destination host is not involved; gets original application layer message. 23 Application Transport Internet Application Message TCP Segment © 2013 Pearson
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!!! 24 © 2013 Pearson
MSS Default is 536 octets. ◦ Maximum 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. 25 © 2013 Pearson
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. 26 © 2013 Pearson
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 segment. ◦ 536 is only the default—the value to use if no other value is specified by the other side. 27 © 2013 Pearson
28 © 2013 Pearson