As previously mentioned, both TCP and UDP are transport layer protocols. It is up to the developer to determine which of these protocols best matches the requirements of the application being developed. TCP establishes a connection proving reliability and flow control.
This section gives more details about what TCP does and when it is a good idea to use it instead of UDP.
To understand the differences between TCP and UDP, it is important to understand how each protocol implements specific reliability features and how each protocol tracks conversations.
In addition to supporting the basic functions of data segmentation and reassembly, TCP also provides the following services:
• Establishes a session—TCP is a connection-oriented protocol that negotiates and establishes a permanent connection (or session) between source and destination devices prior to forwarding any traffic. Through session establishment, the devices negotiate the amount of traffic that can be forwarded at a given time, and the communication data between the two can be closely managed.
• Ensures reliable delivery—As a segment is transmitted over the network, it could be corrupted or lost completely, for various reasons. TCP ensures that each segment that is sent by the source arrives at the destination.
• Provides same-order delivery—Because networks may provide multiple routes that can have different transmission rates, data can arrive in the wrong order. By numbering and sequencing the segments, TCP ensures segments are reassembled into the proper order.
• Supports flow control—Network hosts have limited resources (that is, memory and processing power). When TCP is aware that these resources are overtaxed, it can request that the sending application reduce the rate of data flow. This is done by TCP regulating the amount of data the source transmits. Flow control can prevent the need for retransmission of the data when the resources of the receiving host are overwhelmed.
For more information on TCP, search the Internet for the RFC 9293.
TCP is a stateful protocol, which means it keeps track of the state of the communication session. To track the state of a session, TCP records which information it has sent and which information has been acknowledged. The stateful session begins with the session establishment and ends with the session termination.
A TCP segment adds 20 bytes (160 bits) of overhead when encapsulating the application layer data. Figure 26-9 shows the fields in a TCP header.
Figure 26-9 Fields of the TCP Header
Table 26-1 identifies and describes the ten fields in a TCP header.
Table 26-1 Details of the TCP Header Fields
Applications That Use TCP (26.2.4)
TCP is a good example of how the different layers of the TCP/IP protocol suite have specific roles. TCP handles all tasks associated with dividing the data stream into segments, providing reliability, controlling data flow, and reordering segments. TCP frees the application from having to manage any of these tasks. Applications, like those shown in Figure 26-10, can simply send the data stream to the transport layer and use the services of TCP.
Figure 26-10 Applications That Use TCP
Check Your Understanding—TCP Overview (26.2.5)
Refer to the online course to complete this activity.