Transport Layer

# Introduction

## Transport-Layer Services

A transport layer protocol provide logical communication between application processes running on different hosts. The transport layer is implemented in the end systems and not in the network routers.

From the application a message is converted in a transport-layer packet (called segment), broken in smaller chunks and passed to the lower network layer. Here each segment is encapsulated within a network-layer packet (the datagram) and send on the network. Each layer participate in the routing of the message and examine only the information that can be found in its respetive “packet layer”.

In general a layer services are constrained by the one provided by the layer under it. However the transport layer add several new services to the IP network layer (reliability, encryption ..).

## Multiplexing and Demultiplexing

The first important extension of UDP and TCP over the IP protocol is that message sent from host to host can now be sent from application to application. Communication on the network begin with sockets, each application can use multiple socket and every socket has an unique identifier. When packets are sent, the transport layer gather all packets and send them over the network layer, this process is called multiplexing; when packets arrive at the destination the transport layer perform instead demultiplexing by examining the content of the segment and directing each packet to the specific socket.

To achieve multiplexing and demultiplexing the transport layer uses ports (a $16$ bit number from $0$ to $65535$) to identify different socket (used by application) on the same host.

UDP sockets utilize two pair of address and port <src_address, src_port> and <dest_address, dest_port>, to perform those operations. This means if two segment have the same destination address and destination port they will be sent to the same destination socket (even if, for example, their source port is different).

TCP on the other hand create a different socket for each different tuple of <src_address, src_port, dest_address, dest_port>. That means that for two segment to be sent to the same socket they need to have all four field equal. TCP has a welcoming socket usually listening on port $1200$; on every connection to this socket a new socket is create for the respective four element tuple.