7 July - CN - TCP Timestamp, TCP States
Duration: 1 hr 48 min
This video lesson is available to enrolled students.
AI Summary
An AI-generated summary of this video lecture.
This comprehensive lecture covers the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) in detail. The instructor begins by explaining the limitations of TCP, specifically its inability to support broadcasting or multicasting due to its connection-oriented nature. The lecture then contrasts TCP with UDP, highlighting TCP's reliability features like sequence numbers, acknowledgments, and retransmission, versus UDP's lack of error control and flow control. Detailed diagrams of the UDP and TCP headers are presented, breaking down fields such as ports, sequence numbers, flags, and checksums. The instructor delves into TCP timers, including the Retransmission Timeout (RTO), and provides step-by-step formulas for calculating Round Trip Time (RTT), Smoothed RTT (SRTT), and RTT Variation (RTTVAR). The concept of Maximum Segment Size (MSS) and Path MTU Discovery (PMTUD) is explained with numerical examples. The lecture concludes with a thorough review of TCP connection termination states, flags like RST, and a series of solved exam questions to reinforce understanding of TCP/IP concepts.
Chapters
0:00 – 2:00 00:00-02:00
The lecture begins with a title card displaying the name 'Sanchit Jain'. The instructor then introduces the topic of 'Failure of TCP - At broadcasting'. The on-screen text explains that TCP does not support broadcasting or multicasting because it is a connection-oriented, unicast-only protocol designed for point-to-point communication between exactly two hosts. It highlights that before any data transfer, TCP establishes a reliable connection using a three-way handshake. The text notes that performing a handshake with multiple receivers simultaneously violates the design of TCP. Furthermore, TCP uses unicast IP addresses, meaning it is intended to send data to one host at a time, whereas broadcasting requires addressing multiple destinations, which IP and TCP cannot handle.
2:00 – 5:00 02:00-05:00
The instructor transitions to comparing TCP and UDP. The screen displays text stating that TCP has no sequence number means no reordering of segments and no retransmission, no acknowledgment means no reliability and error control, no window size means no flow control, and no SYN flag means no handshaking. It is noted that when reliable service is wanted, TCP is used. Services like HTTP, FTP, and SMTP use TCP. Conversely, when fast service is wanted and reliability doesn't matter, UDP is used. The text emphasizes that UDP is good for short messages while TCP is good for long messages.
5:00 – 10:00 05:00-10:00
The lecture focuses on the User Datagram Protocol (UDP). A diagram of the UDP header is shown, indicating it is 8 bytes long. The header contains Source Port, Destination Port, Length, and Checksum fields. The instructor explains that UDP is unreliable because it doesn't send global acknowledgments. A 'Bonus' section on the screen asks why UDP has a checksum if it is unreliable. The text explains that the checksum is calculated for datagrams that will reach the destination, but having a checksum does not mean it has error control. The diagram also shows the datagram size can be up to 65535 bytes.
10:00 – 15:00 10:00-15:00
The instructor moves to the TCP header structure. A detailed diagram shows the TCP header fields: Source Port, Destination Port, Sequence Number, Acknowledgment Number, Header Length, Reserved, Flags (URG, ACK, PSH, RST, SYN, FIN), Window Size, Checksum, Urgent Pointer, and Options. The instructor explains that TCP is a connection-oriented protocol. The diagram highlights that the header length is 4 bits, reserved is 6 bits, and the flags are 1 bit each. The window size is 16 bits. The options field can range from 0 to 40 bytes. The data payload follows the header.
15:00 – 20:00 15:00-20:00
The lecture discusses TCP timers. The screen lists different timers: Retransmission timeout timer, Delayed ACK timer, Keep-Alive timer, PAWS mechanism, and Time-wait timer. The Retransmission timeout timer needs timestamps for accurate SRTT and RTTVAR. The Delayed ACK timer helps receivers respond efficiently. The Keep-Alive timer helps avoid premature timeouts. The PAWS mechanism avoids reprocessing old packets. The Time-wait timer is used at the sender after the connection is closed. The instructor explains that all these benefit from timestamps.
20:00 – 25:00 20:00-25:00
The instructor explains how to calculate the Retransmission Timeout (RTO). The screen shows the formula: RTO = SRTT + MAX(G, 4*RTTVAR). G is the clock granularity. The instructor provides an example where IRTT is 100 ms, SRTT is 100 ms, and G is 10 ms. For the first sample, RTTVAR is calculated as RTT/2 = 50 ms. Then RTO is calculated as 100 + MAX(10, 4*50) = 300 ms. For the second sample, RTT is 120 ms. SRTT is calculated using the formula (1-1/8)*100 + 1/8*120 = 102.5. RTTVAR is calculated as (1-1/8)*50 + 1/8*|120-102.5| = 41.875 ms.
25:00 – 30:00 25:00-30:00
The lecture covers Maximum Segment Size (MSS). The screen defines MSS as a TCP option that specifies the maximum amount of data (in bytes) that a device is willing to receive in a single TCP segment, excluding the TCP header. It controls the maximum size of the TCP payload. MSS helps ensure that TCP segments are not too large to fit in the underlying IP packet. The formula MSS = MTU - IP Header - TCP Header is shown. An example is given where MTU for ethernet is 1500 bytes, IP header is 20 bytes, and TCP header is 20 bytes, resulting in an MSS of 1460 bytes.
30:00 – 35:00 30:00-35:00
The instructor discusses Path MTU Discovery (PMTUD). The screen explains that TCP's MSS and IP layer's path MTU discovery collaborate to optimize the size of transmitted packets so they don't get fragmented. The process involves sending packets with the Don't Fragment (DF) bit set. If a router can't forward the packet due to MTU limits, it drops it and sends back an ICMP 'fragmentation needed' message. The sender then reduces its packet size and tries again. The instructor notes that MSS works with PMTUD to adjust segment size.
35:00 – 40:00 35:00-40:00
The lecture covers Maximum Segment Life (MSL). The screen defines MSL as the maximum amount of time a TCP segment can exist in the network before being discarded. MSL defines an upper bound on how long any TCP packet might roam in the network due to routing delays, buffering in routers, retransmissions, and problems due to intermediate devices. The purpose of MSL is to prevent TCP segment collisions between old and new connections that might use the same socket pair. The instructor notes that TCP waits 2*MSL before fully closing a connection in the TIME-WAIT state.
40:00 – 45:00 40:00-45:00
The instructor explains the Time-Wait timer. The screen states that the host that sends the last ACK in a connection termination goes into the TIME-WAIT state. It stays for 2*MSL time, which guarantees the final ACK can be retransmitted if needed. This ensures all old packets from the closed connection are expired or discarded before the socket pair can be reused. The diagram shows the 4-way FIN-ACK process, including states like FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, LAST-ACK, and TIME-WAIT. The instructor emphasizes that this prevents reuse of the same socket pair before old packets are gone from the network.
45:00 – 50:00 45:00-50:00
The lecture covers TCP flags and fields. The screen shows the RST flag, which is 1 bit. It is a control flag in the TCP header used to immediately terminate a connection without following the 4-way FIN segments termination handshake. A TCP segment with the RST flag set to 1 tells the receiver to immediately abort the connection. The receiver does not acknowledge the RST; it is a one-way signal. The instructor also explains the Acknowledgment field, which is 32 bits and indicates the next expected sequence number. The Checksum is 16 bits and covers both header and data to detect corruption during transmission.
50:00 – 55:00 50:00-55:00
The instructor discusses TCP options and dynamic adjustment. The screen asks 'What can be adjusted dynamically?'. It lists MSS (No, set during 3-way handshake), MTU (Yes, not set during handshake so can be changed), Window Size (Yes, used in flow control and congestion control), and Timestamps (Yes, sometimes). The instructor notes that if you want to change MSS, you must close the connection and initiate a new one. The lecture then introduces the Silly Window Problem, which occurs when bandwidth utilization is less due to small window size.
55:00 – 60:00 55:00-60:00
The lecture explains the Silly Window Problem and its solution. The screen shows a diagram of the Sender's Application layer, Sender's TCP, Receiver's TCP, and Receiver's Application layer. The problem arises when the sender sends small segments. The solution is given by two scientists: Nagle and Clark. Nagle's algorithm is mentioned as a solution. The instructor explains that if the sender's application layer sends small data, the TCP layer might wait to send a larger segment. The diagram shows a segment of 1 byte being sent, which is inefficient.
60:00 – 65:00 60:00-65:00
The instructor moves to exam questions. Question 3.72 is shown. It asks about the unique sequence number assigned to each byte in TCP. The options are byte, word, segment, message. The instructor indicates the answer is (a) byte. Question 3.73 is then shown. It describes a TCP client and server running on different machines. After data transfer, the client calls close to terminate the connection. The question asks in which state the client-side TCP connection waits for the FIN from the server-side TCP. The options are LAST-ACK, TIME-WAIT, FIN-WAIT-1, FIN-WAIT-2.
65:00 – 70:00 65:00-70:00
The instructor discusses Question 3.66. The screen shows three statements: I. TCP connections are full duplex. II. TCP has no option for selective acknowledgment. III. TCP connections are message streams. The options are combinations of these statements. The instructor explains that TCP connections are full duplex, so statement I is true. TCP does have an option for selective acknowledgment, so statement II is false. TCP connections are byte streams, not message streams, so statement III is false. The correct answer is (a) Only I is correct. The instructor also discusses Question 3.70 about connected UDP sockets.
70:00 – 75:00 70:00-75:00
The instructor analyzes Question 3.42. It describes a TCP connection where the initial sequence number is derived using a time-of-day (ToD) clock. The clock counter increments once per millisecond. The maximum packet lifetime is given as 64s. The question asks for the minimum permissible rate at which sequence numbers used for packets of a connection can increase. The options are 0.015/s, 0.064/s, 0.135/s, 0.327/s. The instructor explains the calculation based on the clock counter and maximum packet lifetime. Then Question 3.30 is shown, which discusses timeout values used in TCP.
75:00 – 80:00 75:00-80:00
The instructor discusses Question 3.30. It presents three statements about the timeout value used in TCP. Statement (i) says the timeout value is set to the RTT measured during TCP connection establishment for the entire duration. Statement (ii) says an appropriate RTT estimation algorithm is used to set the timeout value. Statement (iii) says the timeout value is set to twice the propagation delay. The instructor explains that statement (i) is false because RTT is dynamic. Statement (ii) is true. Statement (iii) is false. The correct choice is (b) (i) and (iii) are false, but (ii) is true.
80:00 – 85:00 80:00-85:00
The instructor analyzes Question 3.39. It describes a TCP message consisting of 2100 bytes passed to IP. The first network can carry a maximum payload of 1200 bytes per frame, and the second network can carry a maximum payload of 400 bytes per frame, excluding network overhead. The IP overhead per packet is 20 bytes. The question asks for the total IP overhead in the second network. The instructor explains that the packet is fragmented. The first network fragments the 2100 byte message into two packets of 1200 bytes each (plus 20 byte header). The second network further fragments these. The total IP overhead is calculated based on the number of packets.
85:00 – 90:00 85:00-90:00
The instructor discusses Question 3.38. It asks which of the following is NOT part of the IP header. The options are Fragment Offset, Source IP address, Destination IP address, and Destination port number. The instructor explains that the IP header contains source and destination IP addresses, fragment offset, and other fields, but not the destination port number, which is part of the TCP or UDP header. The answer is (d) Destination port number. The instructor also briefly mentions Question 3.37 about the TCP/IP protocol suite.
90:00 – 95:00 90:00-95:00
The instructor analyzes Question 3.37. It asks which of the following is NOT part of the IP header. The options are Fragment Offset, Source IP address, Destination IP address, and Destination port number. The instructor explains that the IP header contains source and destination IP addresses, fragment offset, and other fields, but not the destination port number, which is part of the TCP or UDP header. The answer is (d) Destination port number. The instructor also briefly mentions Question 3.36 about TCP connections being full duplex and message streams.
95:00 – 100:00 95:00-100:00
The instructor discusses Question 3.36. It presents three statements: I. TCP connections are full duplex. II. TCP has no option for selective acknowledgment. III. TCP connections are message streams. The instructor explains that TCP connections are full duplex, so statement I is true. TCP does have an option for selective acknowledgment, so statement II is false. TCP connections are byte streams, not message streams, so statement III is false. The correct answer is (a) Only I is correct. The instructor also briefly mentions Question 3.35 about the TCP/IP protocol suite.
100:00 – 105:00 100:00-105:00
The instructor analyzes Question 3.35. It asks which of the following is NOT part of the IP header. The options are Fragment Offset, Source IP address, Destination IP address, and Destination port number. The instructor explains that the IP header contains source and destination IP addresses, fragment offset, and other fields, but not the destination port number, which is part of the TCP or UDP header. The answer is (d) Destination port number. The instructor also briefly mentions Question 3.34 about the TCP/IP protocol suite.
105:00 – 108:28 105:00-108:28
The instructor concludes the lecture. The screen shows Question 3.34. It asks which of the following is NOT part of the IP header. The options are Fragment Offset, Source IP address, Destination IP address, and Destination port number. The instructor explains that the IP header contains source and destination IP addresses, fragment offset, and other fields, but not the destination port number, which is part of the TCP or UDP header. The answer is (d) Destination port number. The instructor summarizes the key points of the lecture, emphasizing the importance of understanding TCP headers, timers, and connection states for exams.
This lecture provides a deep dive into the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP), focusing on their structural differences, operational mechanisms, and practical applications. The instructor begins by clarifying TCP's limitations, specifically its inability to support broadcasting due to its connection-oriented, point-to-point design. The core of the lecture contrasts TCP's reliability features—such as sequence numbers, acknowledgments, and retransmission—with UDP's connectionless, unreliable nature. Detailed diagrams of the UDP and TCP headers are dissected, explaining fields like ports, sequence numbers, flags, and checksums. A significant portion is dedicated to TCP timers, particularly the Retransmission Timeout (RTO), with step-by-step formulas for calculating Round Trip Time (RTT), Smoothed RTT (SRTT), and RTT Variation (RTTVAR). The concept of Maximum Segment Size (MSS) and Path MTU Discovery (PMTUD) is explained with numerical examples to illustrate how packet sizes are optimized. The lecture also covers TCP connection termination states, flags like RST, and the Time-Wait timer's role in preventing old packets from interfering with new connections. Finally, the instructor reinforces these concepts by solving a series of exam questions, covering topics from sequence numbers to IP header fields, ensuring students are well-prepared for assessments.