Table of Contents
Before, we have talked about TCP and UDP as an overview. In this CCNA Certification Lesson, we will compare these two transport layer protocols and check their main characteristics. We will compare them and we check TCP vs UDP. This comparison is very important in networking world and it is generally a question asked in a Network Engineering Technical Interview. So, this lesson is an important lesson of network engineering certification exams.
There is also another transport layer protocol named SCTP (Stream Control Transmission Protocol). In another lesson, we will lso compare SCTP and TCP. We will learn SCTP vs TCP.
Below, you can find a table that compares TCP vs UDP. You can also find the explanation of each part below:
TCP is a Secure transport protocol but UDP is not secure if we compare it with TCP and SCTP. This is one of the key difference of these two protocols.
The other difference is about connections and sessions. In User Datagram Protocol, you do not need a connection, so it is a connectionless transport protocol. But Transmission Control Protocol needs a connection. TCP is a connection-oriented protocol. It provides this with TCP 3-Way Handshake. And terminates this session with TCP 4-Way Handshake.
About being fast, this time UDP wins, it is faster than TCP. It needs less actions to send data, because it is connectionless and it has no good security mechanisms. But TCP is a slow protocol because of its additional mechanism. So, if you need a fast communication and if some loss is not important, you can use User Datagram Protocol. But if security is number one for you, then you should use Transmission Control Protocol.
TCP is a reliable protocol. Because, TCP guarantees the delivery of the data with ACK mechanism. If any segment does not reach to the destination and the sender does not receive an ACK in a certain time, it resends the segment again. UDP has no such an ACK mechanism. So, UDP does not guarantee the data delivery. It is an unreliable transport protocol.
As we have mentioned before, TCP is secure but slow. So, it is used in Critical applications like file transfers, secure web etc. But User Datagram Protocol is unsecure but fast. So, UDP is used in real-time applications like voice services, live conferences, online games.
In TCP session, packets can be sent in different orders. Transmission Control Protocol has a mechanism that reorders these packets at the receiver end. But UDP has no such a reorder mechanism.
Beside reordering mechanism, TCP also has Flow Control, Window scaling. It dynamically sets the window size for the optimum transmission. There is no such a flow control in UDP.
TCP provides extensive error checking mechanism which are not used in User Datagram Protocol. UDP uses basic checksums for error checking. So, it is susceptible to the data loses. Generally, applications that uses UDP, provide its own error-recovery.
There is a big difference also about the length of the headers. TCP Header is 20 Bytes long and this value can be increased up to 60 bytes with option fields. But UDP Header is fixed 8 Bytes long.
Beside these differences, different protocols and applications use different TCP and UDP Port Numbers. Now, let’s talk about these ports detailly.
In networking, different ports are used for various purposes. Generally, these port ranges can be divided into three categories. Below, you can find these port ranges:
The applications which use TCP Protocol (Transmission Control Protocol) and UDP Protocol (User Datagram Protocol) use some of these Well-Known Ports. They use only TCP ports, only UDP port or they use ports of both.
Let’s see, some of these Well-Known Network Ports and compare TCP vs UDP ports.
After checking the same UDP and TCP ports used by the protocols, now, let’s see the protocols which use only TCP ports. In other words, there are some Applications that use Transmission Control Protocol (TCP) . Some of these protocols are given below:
Now, let’s talk about the protocols which use only User Datagram Protocol (UDP) Ports. Some of these protocols are given below:
First of all, let’s talk about the protocol that use both UDP and TCP ports. There are different protocols and applications use both TCP and UDP ports. One of the well-known network protocols which use both TCP and UDP ports is DNS. DNS uses TCP and UDP port 53. It uses the same port of both of these protocols.
You can find the whole list of these ports at the IANA Website. In this list you can also see the ports of other Trasport Layer protocols, Stream Control Transmission Protocol (SCTP) and Datagram Congestion Control Protocol (DCCP) beside UDP and TCP.