 Hello and welcome to the session on TCP error control. At the end of this session, students will be able to uniquely identify the phases in the error control of TCP. TCP is a reliable transport layer protocol. This means that an application program that delivers a stream of data to TCP relies on TCP to deliver the entire stream to the application program. On the other end, that should be in order, without order, and without any part lost or duplicate. TCP provides reliability using error control. Error control includes mechanisms for detecting and resending corrupted segments, resending lost segments, storing out of order segments until missing segments arrive, and detecting and discarding duplicated segments. In this session, we will discuss following topics, checksum, acknowledgment, acknowledgment type, retransmission, and out of order segments. Each segment includes a checksum field, which is used to check for a corrupted segment. If a segment is corrupted, as deleted by an invalid checksum, the segment is discarded by the destination TCP and is considered as lost. TCP uses a 16-bit checksum that is mandatory in segment. TCP uses acknowledgments to confirm the receipt of data segments. Control segments that carry no data but consume a sequence number are also acknowledged. ACK segments are never acknowledged. ACK segments do not consume sequence numbers and are not acknowledged. Previously, TCP uses only one type of acknowledgments, that is cumulative acknowledgment. Now, today, some implementations also use selective acknowledgments. Cumulative acknowledgment also represented as ACK. TCP was originally designed to acknowledge receipt of segments cumulatively. The receiver advertises the next byte it expects to receive, ignoring all segments received and stored out of order. This is sometimes referred as positive cumulative acknowledgment or just ACK. The word positive indicates that no feedback is provided for discarded, lost, or duplicate segments. The 32-bit ACK field in the TCP header is used for cumulative acknowledgments and its value is valid only when the ACK flag bit is set to 1. Selective acknowledgment also referred as SAC. More and more implementations are adding another type of acknowledgment called as selective acknowledgment or SACK. A SAC does not replace ACK but reports additional information to the sender. A SACK reports a block of data that is out of order and also a block of segments that is duplicated means received more than once. Let us think about when does a receiver generates acknowledgments. Actually, from the inception of TCP, several rules have been defined and used by several implementations. Here are the most common rules stated. The order of the rule does not necessarily define its importance. The first one, when end A sends a segment to end B, it must include an acknowledgment that gives the next sequence number it expects to receive, that is piggybacking acknowledgment. This rule decreases the number of segments needed and therefore reduces traffic. The second rule is that when the receiver has no data to send and it receives an in-order segment and the previous segment has already been acknowledged, the receiver delays sending an ACK segment until another segment arrives or until a period of time has passed. In order, the receiver needs to delay sending an ACK segment if there is only one outstanding in-order segment. This rule reduces ACK segment traffic. Third one is when a segment arrives with sequence of number that is expected by the receiver and the previous in-order segment has not been acknowledged, the receiver immediately sends an ACK segment. There should not be more than two in-order acknowledgment segments at any time. This prevents the unnecessary retransmission of segments that may create congestion in the network. Fourth one, when a segment arrives with an out-of-order sequence number that is higher than the expected, the receiver immediately sends an ACK segment announcing the sequence number of the next expected segment. This leads to the fast retransmission of missing segments. When a missing segment arrives, the receiver sends an acknowledgement segment to announce the next sequence number expected. This informs the receiver that segments reported missing have been received. If a duplicate segment arrives, the receiver discards the segment but immediately sends an acknowledgement indicating the next in-order segment expected. Here are some scenarios for generating ACK. The first one, the first scenario shows the bidirectional data transfer between two systems as shown in figure. The client TCP sends one segment, the server TCP sends three. The figure shows which rule applies to each acknowledgement for the client first segment and all three server segments rule one applies. There are data to be sent to the segment displayed the next byte expected. When the client receives the first segment from the server, it does not have any more data to send. It needs to send only ACK segment. However, according to rule two, the acknowledgement needs to be delayed for 500 millisecond. That is the retransmission timeout set at the receiver side. To see if any more segments arrive, when the ACK delaying timer matures, it triggers an acknowledgement. This is because the client has no acknowledge if other segments are coming. It cannot delay the acknowledgement forever. When the next segment arrives, another ACK delaying timer is set. However, before it matures, the third segment arrives. The arrival of the third segment triggers another acknowledgement based on rule three. Here in this scenario, what happens when a segment is lost or corrupted? Lost or corrupted segment is treated the same way by the receiver. Lost segment is discarded somewhere in the network. Maybe corrupted segment is discarded by the receiver itself. Both are considered lost. Figure shows such type of situation. Here we assume that the data transfer is unidirectional. One site is sending and the other site is receiving. Here in this scenario, the sender sends segment one and segment two, which are acknowledged immediately by an ACK, that is rule three. However, the receiver receives the segment four, which is out of order. The receiver stores the data in the segment in its buffer but leaves a gap to indicate that there is no continuity in the data. The receiver immediately sends an acknowledgement to the sender, displaying the next byte it expects, that is rule four. Note that here the receiver stores bytes 801 to 900 but never delivers these bytes to the application until the gap is filled. The sender TCP keeps one RTO timer for the whole period of connection. When the third segment times out, the sending TCP resends segment three, which arrives this time and acknowledged properly. Here pause the video and give the correct answer. The answer is D. Actually, the error control and flow control. The difference is that the flow control is totally controlled, the flow of data till it reach to the client. And the error control, error controls the data, which find that the data should be received at the receiver without error. So, that's why answer is D. Answer is B checksum because for error detection, the checksum also includes some other bits which are going to be find out the errors when that data is going to be received at the receiver side. So, the checksum is used for finding the errors in the data. Here are the references. Thank you.