TCP DUPACK: When You Need to Send a Double Acknowledgement

tcp dup ackTransmission Control Protocol (or TCP) converts messages or files into data packets that are transmitted over the network connection to a destination computer or other networking device. Then the packets are reassembled to messages or files that can then be read by the destination. The Internet Protocol provides the transmitting operation configuring the connections address, so that the information reaches the right location. Today we walk you through, TCP duplicate Acknowledgment (DUPACK). We assume that you are familiar with the concepts and basics of computer networking. Else you can take this introductory course to Computer Networks.

What is TCP?

TCP provides reliable ordered and error checked communication between programs running on computers connected to the Internet.Web browsers use this protocol when they connect to servers on the World Wide Web. Protocols encapsulated in TCP include HTTP,HTTPS, SMTP, POP3, IMAP, SSH, FTP, Telnet and others. To learn more about the TCP/IP stack, we strongly recommend you take this course.

Data Communication using TCP/IP

TCP works by exchanging units of information known as packets. A packet is a sequence of bytes and consists of a header followed by a body. The header contains the packet’s source and destination. The body contains the data that is to be transmitted using TCP. TCP Packets can be lost, duplicated or delivered out of order. The reasons are traffic congestion, traffic load balancing and others.  TCP has built in mechanisms to detect these problems and request re-transmission of lost data or to rearrange out-of-order data. TCP ensures accurate delivery rather than timely delivery. It guarantees all bytes received will be identical with bytes sent and in the correct order.

As packet transfers over several networks, that may or may not be reliable, a technique called positive acknowledge with re-transmission is used to ensure, reliability of packet transfers. It is compulsory, in this method, for the receiver to respond with an acknowledgement message as it receives the data. The sender maintains a record of each packet it sends. Sender also has a timer when the packet was sent and re-transmits the packet if the timer goes off before the message has been acknowledged. The timer is required in case of loss or corruption of packet.

TCP Header Format

Source port gives the 16 bits senders address. While the destination port gives the 16 bit receivers address. If the sequence number flag is set then it is the initial sequence number. Acknowledgement number is 32 bits. If the ACK flag is set, then the value of the field is the next sequence number expected by the receiver. Note that the first ACK send by each end acknowledges the other ends initial sequence number itself. But not data. A TCP sender calculates a value based on the contents based on the TCP header and data fields. This 16 bit value is compared with the value the receiver generates using the same calculation. If the values match, there is a high chance that the segment arrived intact. A network engineer needs to understand the packet structure and values to be able to decipher what’s going on and how the packets are being transmitted. If you’re aiming to become a network engineer, you should first try out this Network Engineer primer course.

TCPDupAck

TCP Duplicate Acknowledgement

When a sender sends a segment, information is also sent about the sequence number used. The receiver sends an acknowledgement(ACK) with the ACK flag set. This tells the sender that the receiver received that segment. Note that for TCP segment there is a retransmission timer bound to it. If the sender doesn’t receive an ACK from the receiver for the TCP segment sent before the timer expire then the sender retransmits the same TCP segment.

It may also happen sometimes that a receiver receives a TCP segment with a sequence number higher than the expected one. Then the receiver sends an immediate ACK with the relevant field set to the Sequence number the receiver was expecting. Note that this ACK is duplicate of an ACK which was previously sent. The reason to do this is to update the sender with regards to the dropped/missing TCP segments. Once, 2 DUP ACKS(Dupilcate Acknowledgements), TCP performs a retransmission of that segment without waiting for the expiry of the retransmission timer. This is known as Fast Retransmit.

We hope this gives you a fair idea of how the TCP Duplicate Acknowledgement works. Of course, this is just a brief explanation. You need to remember that this works in tandem with all the other safety mechanism inbuilt into TCP. You can learn more about them in this TCP/IP course.