Transport layer , which resides between the application layer and network layer, is a central piece of the layered network architecture. It’s role is critical in providing communication services directly to the application process running on different hosts.
Transport Layer Protocols
The internet makes two distinct transport layer protocol available to the application layer:
UDP, which stands for User Datagram Protocol, proves an unreliable connectionless service to the invoking application.
TCP, which stands for Transmission Control Protocol, provides a reliable, connection-oriented service to the invoking application.
When designing a network application, the application developer must specify one of these two transport protocols.
To simplify terminology, when in an internet context, we refer to the transport packet as a segment. We mention, however, that the internet literature (for example, the RFCs) also refer to the transport-layer packet for TCP as a segment but often refers to the packet for UDP as a datagram. But this same internet literature also uses the term datagram for the network-layer packet! For understanding purpose, I think, it would be less confusing to refer both TCP and UDP packets as segments, and reserve the terms datagram for the network-layer packet.
It will be useful to know a few things about the internet’s network layer, before we proceed our introduction to UDP and TCP.
The internet’s network-layer protocol has a name – IP, for Internet 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. In particular, it does not guarantee segment delivery, it does not guarantee orderly delivery of segments, and it does not guarantee the integrity of the data in the segments. For these reasons, IP is said to be an unreliable service. We also mention here that every host has at least one network-layer address, a so-called IP address. We’ll examine IP addressing in detail in Module 4; as of now, we need only keep in mind that each host as an IP address.
Transport Layer Services
Having taken a glimpse at the IP service model, let’s now summarize the service models provided by UDP and TCP. The most fundamental responsibility of UDP and TCP is to extend IP’s delivery service between two end systems to a delivery service between two processes running on the end systems. Extending host-to-host delivery to process-to-process delivery is called transport-layer multiplexing and demultiplexing.
UDP ad TCP also provide integrity checking by including error detection fields in the segments’ header. These two minimal transport-layer services- process-to-process data delivery and error checking – are the only two services that UDP provides! In particular, like IP, UDP is an unreliable service- it does not guarantee that data sent by one process will arrive intact (or at all!) to the destination process.
TCP on the other hand, offers several additional services to applications. First and foremost, it provides reliable data transfer. Using a flow control, sequence numbers, acknowledgements, and timers, TCP ensures that data is delivered from sending process to receiving process, correctly and in order. TCP thus converts, IP’s unreliable service between end systems into a reliable data transport service between processes. TCP also provides congestion control. Congestion control is not so much a service provided to the invoking application as it is a service for the internet as a whole, a service for the general good. Loosely speaking, TCP congestion control prevents any one TCP connection from swamping the links and routers between communicating hosts with an excessive amount of traffic. TCP strives to give each connection traversing a congested link an equal share of the link bandwidth. This is done by regulating the rate at which the sending sides of TCP connections can send traffic into the network. UDP traffic, on the other hand, is unregulated. An application using UDP transport can send at any rate it pleases, for as long as it pleases.
Transport Layer Functions
A transport-layer protocol provides for logical communication between application process running on different hosts. By logical communication, we mean that from an application’s perspective, it is as if the hosts running the processes were directly connected; in reality, the hosts maybe on opposite sides of the planet, connected via numerous routers and a wide range of link types. Application processes use the logical communication provided by the transport layer to send messages to each other, free from the worry of the details of the physical infrastructure used to carry these messages. The figure below illustrates the notion of logical communication.
As you can see in the above figure, 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 it receives from a sending application process into transport-layer packets, known as transport-layer segments in internet terminology.
This is done by breaking the application messages into smaller chunks and adding a transport-header to each chunk to create the transport layer segment. The transport layer then passes the segment to the network at the sending end system, where the segment is encapsulated within a network-layer packet (a datagram) and sent to the destination. It’s important to note that network routers act only on the network-layer segment encapsulated with the datagram. On the receiving side, the network layer extracts the transport-layer segment from the datagram and passes the segment up to the transport layer. The transport layer then process the received segment, making the data in the segment available to the receiving application.