What You Need to Know About the TCP/IP Transport Layer
The goal of networking is to provide communications between different systems needing data exchange.
However, not all systems operate in the same way. To organize internetworking complexity and overcome the proprietary functionalities of various vendors, the OSI and TCP/IP communications models were created.
Both models represent a network in terms of layers, where each layer has a particular role and is responsible for executing specific functions. This way, any system can exchange information with others, regardless of their architectural differences.
The transport layer in both the OSI and TCP/IP models is responsible for providing a logical connection between communicating hosts and transport services between a source and destination.
This article will provide the following:
- An overview of the TCP/IP transport layer.
- An outline of its functionalities and benefits.
- An explanation of the characteristics of TCP.
- An explanation of the characteristics of UDP.
- An explanation of the differences between reliable and best-effort transport.
Not what you were looking for today? View some of our popular articles:
- Learn the Packet Delivery Process (Default Gateway and ARP) - Pt. 1
- It's About Time – The Importance of NTP for Networks
- Back to the Basics: Is Static or Dynamic Routing Better?
Transport Layer Functions
The transport layer operates between the application and internet layers of the TCP/IP protocol stack. The transport layer of the TCP/IP stack is equivalent to the transport layer of the OSI model, where it resides between the transport and session layers.
The main functionality of the transport layer is to track communications between the applications used on the source and destination hosts. As much as the transport layer successfully operates in general, it cannot guarantee that the data will always arrive in the correct order, not corrupted or that the information will even arrive at the destination device.
TCP and UDP are the two most important transport layer protocols that applications use for exchanging data. Although both protocols manage communications between devices similarly, they operate differently and provide different benefits.
For example, while TCP offers reliability and ensures data delivery, UDP provides best-effort communications without insurance.
________________
Can't get the hardware you need?
Here's what one recent customer had to say:
"That was the fastest delivery, once you had PO I had the equipment in my warehouse." -- Robert W.
Send PivIT a request or connect with our Team in real time using our chat feature.
________________
Understanding Session Multiplexing
Most of the time, multiple communications simultaneously run on a device.
For instance, you will only sometimes be doing just a single thing on your computer. You may be searching the web, downloading files, chatting, or playing games online, all at the same time.
Though some applications use TCP while others use UDP, the transport layer tracks these communications and keeps them separate. The support provided by the transport layer for using multiple TCP and UDP sessions simultaneously over a single link is called session multiplexing.
A single session is created when a device sends data to the destination, which usually involves a replay. Typical network communication on a single device involves numerous applications running over TCP and UDP simultaneously. Both TCP and UDP protocols track the sessions and keep them separate.
When multiple sessions from multiple applications run simultaneously, the transport layer is responsible for identifying the target application to pass data to the appropriate application. This identification is achieved by using the port numbers used in the transport layer.
Each communication between two devices is established from a source to a destination port. The source port is a random number higher than 1023, while the destination port identifies the application used and has a number in the range of 1-1023 (well-known ports predefined for application use).
As shown in the image above, two sessions are running: one TCP and one UDP. The UDP session is needed for communicating with the DNS server and obtaining the public IP address for the domain (website) the PC is trying to open, while the TCP session is for communicating with the web server afterward. The ports (destination ports in the sessions) identifying DNS and HTTP are UDP port 53 and TCP port 80, respectively.
__________________
Is your hardware maintenance plan coming to an end and due for renewal? Be sure to find out the three maintenance optimization strategies you can’t afford to miss in the video below:
__________________
Segmentation and Flow Control
The amount of data that can be sent to the destination depends on the maximum transmission unit (MTU) of the underlying network layers being used, which by default is 1500 bytes for the Ethernet protocol. However, TCP and UDP approach this process differently.
TCP is responsible for breaking up the data from the application layer into smaller segments that will fit the MTU and prepare them for transport in the network.
In contrast, UDP does not provide such segmentation services and relies on the application to perform that when it is required.
Successfully transferring packets between communicating hosts provides better network efficiency. However, when packets are dropped because of congestion or there are not enough processing resources on the devices, TCP introduces retransmissions and latency.
To protect from such issues, a flow control method is used, where everything depends on acknowledgments generated by the receiver.
However, this may slow the overall transmission rate to an unacceptable level in some situations. To overcome this, a mechanism called “windowing” is used. It allows the receiver to notify the sender how much data can receive before replying with an acknowledgment.
TCP Overview
TCP is a connection-oriented protocol that establishes a session connection between the hosts before they start exchanging data traffic. Once the transmission is complete, the session is terminated.
When setting up a connection, TCP creates a session in three steps, and the whole process is called a three-way handshake. In the first step, the source sends a synchronization (SYN) segment with a sequence number of 0.
In the second step, the destination host responds to the received SYN with acknowledgment altogether with an SYN. The acknowledgment value is 1 (always the number that follows the sequence number of the received segment), while the SYN has a sequence number of 0, like in the first initial step.
In the third step, the source host replies to the received SYN from the destination host with acknowledgment of 1, and the TCP session is established.
In the same way, as with the three-way handshake, TCP uses sequence numbers for identifying the segments and acknowledgments.
The communication continues only after successful confirmation, and missed segments are always resent. This approach provides reliable data transmission during the activity of the session.
Moreover, TCP supports error checking, which helps to discover any corruption in the TCP headers. On top of that, TCP also provides recovery services which greatly help in some instances. Last but not least, TCP provides flow control that allows a maximum amount of data to be exchanged at once before an acknowledgment is received.
UDP Overview
Unlike TCP, UDP is a very simple protocol, and most TCP features are not supported. However, it does not make the UDP protocol less valuable. UDP is preferred over TCP in some situations, but we will discuss this briefly.
UDP is a connectionless protocol, so there is no need for a session establishment for one host to send data to another. Because of that, segments are sent without advance notification to the destination host.
UDP also does not use sequencing, so it cannot provide reliability during transmissions. As a result, once segments are sent, there is no way to determine whether they have been successfully received. That’s why UDP is considered a best-effort protocol.
Finally, UDP performs only limited error checking and does not support any mechanism for recovering lost or corrupted packets. Therefore, it relies on the application itself to perform such actions.
Reliable vs. Best-Effort Transport
TCP and UDP protocols have the same goal and responsibilities, but they function almost as opposites based on how they operate and function. Although TCP is a more complex protocol than UDP, they are equally valuable for different applications and services. The following table shows the main functionalities of both protocols, their differences, and their general use.
Same Goal, Different Purpose
Both TCP and UDP have the same responsibility when data traffic is exchanged between hosts.
However, based on their functionalities and the features they support, one would be a better choice in certain situations.
TCP is the protocol when reliability is the goal, such as when downloading files or using email. However, when speed and low latency are the main priority for the communication session, then UDP is the obvious choice.
Therefore, there is no winner between these two transport layer protocols. They have the same responsibilities but are approached differently. That is why some applications use TCP, while others use UDP. Use this guide the next time you need to determine which option is best for you.
PivIT's EXTEND offering can step in to augment your team and remote in to configure your gear with expert-level engineers (SmartHands | EXTEND). If you need someone on-site, we have field services ready at a moment's notice. Get your switches protected today!