2.3 The Transport Layer (TCP)

The Internetwork layer is both simple and complex. It looks at a packet’s destination address and finds a path across multiple network hops to deliver the packet to the destination computer.
But sometimes these packets get lost or badly delayed. Other times the packets arrive at their destination out of order because a later packet found a quicker path through the network than an earlier packet. Each packet contains the source computer’s address, the destination computer’s address, and an offset of where this packet “fits” relative to the beginning of the message. Knowing the offset of each packet from the beginning of the message and the length of the packet, the destination computer can reconstruct the original message even if the packets were received out of order.
As the destination computer reconstructs the message and delivers it to the receiving application, it periodically sends an acknowledgement back to the source computer indicating how much of the message it has received and reconstructed. But if the destination computer finds that parts of the reconstructed message are missing, this probably means that these packets were lost or badly delayed. After waiting a bit, the destination computer sends a request to the source computer to resend the data that seems to be missing.
The sending computer must store a copy of the parts of the original message that have been sent until the destination computer acknowledges successful receipt of the packets. Once the source computer receives the acknowledgment of successful receipt of a portion of the message, it can discard the data that has been acknowledged and send some more data.
The amount of data that the source computer sends before waiting for an acknowledgement is called the “window size”. If the window size is too small, the data transmission is slowed because the source computer is always waiting for acknowledgments. If the source computer sends too much data before waiting for an acknowledgment, it can unintentionally cause traffic problems by overloading routers or long-distance communication lines. This problem is solved by keeping the window size small at the beginning and timing how long it takes to receive the first acknowledgements. If the acknowledgments come back quickly, the source computer slowly increases the window size and if the acknowledgements come back slowly, the source computer keeps the window size small so as not to overload the network. Just like at the Link layer, a little courtesy on the Internet goes a long way toward ensuring good use of the shared network infrastructure.
This strategy means that when the network has high-speed connections and is lightly loaded the data will be sent quickly, and if the network is heavily loaded or has slow connections the data will be slowed down to match the limitations of the network connections between the source and destination computers.

Back to Book’s Main Index