Transport Layer


Services Overview

I really suggest you to take a brief look at a previous article I write, which acts as a sort of introduction: Network of Networks. [//]: # (TODO use ArticleList component for the link above)

Information packets at transport layer are called segments. The most used transport layer protocols are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). They both take care about the transportation of application layer messages by moving them to peripheral application points. Transport protocols rely on underlying network layer.

Many networks provide the different transport protocols to the network applications that reside inside. It is possible to classify those protocols under the following features:

  • Reliable data transfer: Ensure all the pieces of information are correctly received. Loss-tolerant applications don’t need this feature.
  • Throughput: Bandwidth-sensible applications have specific throughput requirements, while elastic applications use the available throughput without experiencing failure.
  • Timing: A crucial aspect of real-time applications like VoIP.
  • Security: Declined under the aspects of the privacy, data integrity and authentication.

Note that VoIP stands for Voice over Internet Protocol.


Diving deep into transport services a computers network can provide, let’s analyze which transport protocols can provide the Internet network.

UDP Services

UDP stands for User Datagram Protocol. It is a light-weight, non-reliable data transfer protocol. It does not provide handshaking procedure.

It is diffused in video streaming applications like YouTube. You can loose some frames without loosing the meaning of a video.

Some firewalls are set to block UDP Internet traffic, so many network applications which could work on UDP (like Skype), are designed to use TCP protocol as a fall-back option. Many network applications turn out to perform better with UDP. If an application performs many controls at application layer level, it needs a transport protocol that quickly sends the segments over the network. UDP suits better, since TCP will perform many other checks that will slow down the segments’ travel. Moreover, real time applications often need a minimum sending rate while are tolerant to a given data loss. TCP cannot be used with real time application since it uses many acknowledgment techniques to check if all the segments are properly delivered.

TCP Services

TCP stands for Transmission Control Protocol. Note that writing something like “TCP protocol” becomes than redundant! TCP specification are provided into RFC 793. The TCP connection is point-to-point: there can be only a sender and a receiver.

The TCP provides a service that is connection-oriented and reliable.

Both those features are primarily ensured by the handshaking procedure. The client and the server must exchange control information at the transport layer before proceeding to messages exchange (performed at application layer). After the handshaking phase, the processes have a full-duplex connection: they can exchange messages simultaneously. Lastly, when the processes no longer need to communicate, the application must close the TCP connection.

Connection state is completely housed within both the peripheral systems. Intermediate routers are completely unaware of TCP connections that travel through them.

TCP provides a congestion control mechanism that prevent the network from being slowed down by the huge amount of TCP segments that travel around the hosts. In this regard, it is interesting to note that RFC 793 does not provide information about when TCP should actually send the segments over the network.

Transport Layer Security

The TLS (Transport Layer Security) is a supplementary element that adds security services to TCP. It is very important to understand that TLS is not the third Internet’s transport protocol but an enrichment of TCP.

Segments Structure

UDP Segment

RFC 768 defines the structure of the UDP segments.

NameDimension in bitDescription
Source Port16Number of the port from which the segment depart.
Destination Port16Number of the port to which the segment should arrive.
Length16Number of bytes of the whole UDP segment: header and payload.
Checksum16Error detection technique that checks if the segment has not been compromised.
Data (payload)Up to 32 bitsHold additional information, if needed.

Since IP network layer protocol does not provide nor reliability nor error detection, transport layer should provide a mechanism to ensure error detection: the checksum technique.

End-to-end principle states that a lower level error detection technique, if implemented, become redundant if the upper level also implements it.

UDP uses checksum to detect error, but it does not resolve the errors in any way.

TCP Segment

TCP header usually takes up 20 bytes.

NameDimension in bitDescription
Source Port16Number of the port from which the segment depart.
Destination Port16Number of the port to which the segment should arrive.
Sequence Number32Used for reliable data transfer implementation.
Acknowledgment Number32Used for reliable data transfer implementation.
Window Size16Used by flow control.
Header Length4Specifies the length of the header in multiples of 32 bits.
Flags6TCP has many different flags.
Urgent Pointer16Used for urgent data to send.
Options (optional)variable lengthUsed when sender and receiver negotiate the maximum segment size.
Data (payload)Up to 32 bitsHold additional information, if needed.

Summary

There are several transport layer protocols in addition to UDP and TCP, but these definitely remain the most used. However, it is important to mention:

  • SCTP (Stream Control Transmission Protocol)
    Message-oriented and ensures reliable, in-sequence transport of messages with congestion control.
  • DCCP (Datagram Congestion Control Protocol)
    Message-oriented with reliable connection setup, tear-down, ECN (explicit congestion notification), congestion control, and feature negotiation.
  • QUIC (not an acronym)
    Establish a number of multiplexed connections between two endpoints using UDP, and is designed to obsolete TCP for many applications.