2  Transport layer – TCP

  • TCP is a reliable transport protocol, and performs processes to ensure reliable delivery of data between applications using acknowledged delivery. An analogy for the operation would be ordering some items online for delivery to your home. You will be able to track the progress of the packages while they are in transit, and you may be required to sign for them, which provides acknowledgement of their delivery. You will also be able to contact the seller of the items if any are not delivered to arrange for re-delivery.
  • The four basic functions of TCP are:
    1. Ensuring data segments are delivered in the correct sequence to the correct application layer protocol.
    2. Providing flow control, so segments are delivered at a rate the receiving device can handle.
    3. Multiplexing of multiple user applications, allowing them to simultaneously access the transmission network.
    4. Error checking received segments, and requesting retransmission if segments have been corrupted.
  • TCP breaks up data received from the application layer into small pieces known as segments. To provide reliable transmission, the segments are numbered before being passed to the IP process, which encapsulates them into packets. TCP tracks the number of segments that are sent to a specific destination device from a specific application layer protocol. If it does not receive acknowledgement within a certain period of time, TCP assumes that the segments have been lost and will retransmit them.
  • TCP also checks each segment to ensure that the contents have not been changed during transmission across the network media. This process is referred to as error checking, and is possible because each segment header includes a check-sum, which is a mathematical signature generated by feeding the data in the segment through a cyclical redundancy algorithm. This is placed in the TCP header by the sender, and the receiving device will carry out the same calculation on the data in the received segment. If the signatures match, TCP will consider the data within the segment as not damaged. If the signatures do not match, TCP will arrange for the data to be retransmitted.
  • TCP can serve multiple application layer protocols simultaneously, processing their data into segments and feeding them to the Internet layer in a process called multiplexing. To allow TCP to deliver received segments to the correct application layer protocol, port numbers are used.
  • Because TCP may receive a significant number of segments, which need to be error-checked, sequenced and delivered to the correct application layer protocol, it needs to be able to control the amount of segments it receives to allow it to operate effectively. A TCP receiving process will agree a window size with a TCP sender, which dictates the amounts of segments that can be sent before a TCP acknowledgment is sent by the receiver. The TCP receiver can thus control the amount of segments it is sent, a process called flow control.
Figure 2
  • The diagram above is a graphical representation of a TCP header, which is divided into a series of areas called fields. The numbers across the top indicate the length of each field in bits. The total size of the header is 20 bytes. This header is added to the segment of application data, shown as the orange data field at the bottom. This is referred to as the payload of the segment, and can be a maximum of 1460 bytes.

Activity: Fields in a TCP header

In the diagram above showing the representation of a TCP header, identify the fields that allow TCP to carry out its main function:

Using the following two lists, match each numbered item with the correct letter.

  1. sequencing

  2. flow control

  3. multiplexing

  4. error detection

  • a.check-sum/acknowledgement

  • b.sequence number

  • c.window/acknowledgement

  • d.source/destination port

The correct answers are:
  • 1 = b
  • 2 = c
  • 3 = d
  • 4 = a

1  Layered network protocols

3  TCP three-way handshake