Residing between the application and network layers, the transport layer is a central piece of the layered network architecture. It provides communication services directly to the application processes running on different hosts.

Introduction and Transport-Layer Services

A transport-layer protocol provides logical communication between application process running on different hosts.

logical communication: from an application’s perspective, it’s like the hosts running the process is directly connected

Transport-layer protocols are implemented in the end systems but not in network routers. On the sending side, the transport layer converts the application-layer messages into transport-layer packets(the transport-layer segment). This is done by possibly breaking down the message into smaller chunks and add transport-layer header to each of them. The transport layer then passes the segments to the network layer at the sending end system, where those segments are further encapsulates within a network-layer packet(datagram) and sent to the destination. On the receiving side, the network layer extracts the transport-layer segment and passes up layer by layer to make the data in the segment available to the receiving app.

Relationship Between Transport and Network Layer

A transport-layer protocol provides logical communication between application processes, and a network-layer protocol provides logical-communication between hosts.

The possible services that the transport-layer protocol provides is constrained by the possible services that the netwoek layer service provides. i.e. if the network-layer protocol cannot provide delay or bandwidth guarantees for transport-layer segment sent between hosts, then the transport layer cannot provide delay or bandwidth guarantee between processes.

However, certain services can be offered by transport layer protocol even network protocol doesn’t offer the corresponding service. One example is reliable data transfer, another example is transport protocol can use encryption to guarantee the application messages are not read by intruders.

Overview of the Transport Layer in the Internet

Recall that there’s 2 distinct transport-layer protocol: UDP and TCP.

Before proceeding with the introduction, it’s useful to keep in mind that the Internet’s network-layer protocol, IP, provides logical communication between hosts. The IP service model is a best-effort delivery service. This means that IP makes its “best effort” to deliver segments between communicating hosts, but it makes no guarantees. It is said to be an unreliable services. And for now, keep in mind that each host has an IP address.

The most fundamental responsibility of UDP and TCP is to extend IP’s delivery service between two end systems to delivery service between 2 processes running on the end systems. This extending host-to-host delivery is to process-to-process is called transport-layer multiplexing and demultiplexing. UDP and TCP also provide integrity checking by including error-detection fields in their segments’ headers. (And those are the only 2 services UDP provides)

Multiplexing and Demultiplexing

A process can have one or more sockets, and each socket will have an unique identifier. The format of the identifier depends on the type of socket(UDP or TCP). Each transport-layer segment also has a set of field to identify the receiving socket and then directs the segment to that socket. This job of delivering the data in a transport-layer segment to the correct socket is called demultiplexing. And the job of gathering data chunks at the source host from different sockets, encapsulating each data chunk with header info to create segments, and passing the segments to the network layer is called multiplexing.

To perform multiplexing at transport-layer, the following are required:

  1. each sockets need to have unique identifiers
  2. each segment have special fields that indicate the socket to which the segment is to be delivered

Those 2 fields are named source port number field, and the destination port number field. Each port number is a 16-bit number, ranging from 0 to 65535. Port number ranging from 0 to 1023 are called well-known port numbers and they are restricted for use by protocols such as HTTP(80) and FTP(21) etc.

Connectionless Multiplexing and Demultiplexing