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 we will learn their main characteristics. In other words, we will compare TCP vs UDP. This comparison is very important in networking world and it is generally a Network Engineering Technical Interview Question. This lesson is also an important lesson for network engineering certification exams. Because, there are critical questions are coming from this lesson on certification exams.
By the way, there is also another transport layer protocol named SCTP (Stream Control Transmission Protocol). In another lesson, we will also compare SCTP and TCP. We will learn SCTP vs TCP. But here, our focus is not SCTP.
Below, you can find a table that compares TCP vs UDP. We will also explain each line for you detailly.
Firt of all, TCP is a Secure transport protocol but UDP is not secure protocol if we compare it with TCP and SCTP. This is one of the key difference of these two protocols. But, if you compare TCP with SCTP, SCTP is more secure.
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. In other words, a connection must be established for the communication of this protocol. So, TCP is a connection-oriented protocol. This connection is done with TCP 3-Way Handshake. And connection terminates is done with TCP 4-Way Handshake.
How about speed? If we compare the speed of these two protocols, this time UDP wins, becasue it is faster than TCP. It needs less actions to send data, because it is connectionless and it has no good security mechanisms. 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 the number one case 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. And, UDP does not guarantee the data delivery. So, 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. You can add more to these examples.
In TCP session, sometimes packets can be sent in different orders. So, if we do not do anything, the inordered packets will be meaningful at the other end. We should reorder these packets. Transmission Control Protocol has a mechanism that reorders these packets at the receiver end. But UDP has no such a reorder mechanism. By doing this, TCP make this message meaningful.
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.
How about the headers? How about their sizes? 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. These default port numbers are also asked too much in the network interviews and in certification exams. Now, let’s talk about these default ports and learn them detailly.
In networking, different ports are used for various purposes. Generally, these network 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.
For UDP and TCP default port comparison, let’s firstly learn 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:
Beside these protocols, Gopher, Finger, NNTP, IMAP, LDAP, Quick Mail Transfer protocols use also TCP ports by default. Gopher uses port 70, Finger uses port 79 by default. Network News Transfer Protocol (NNTP) uses port 119, Internet Message Access Protocol (IMAP) uses port 143, Lightweight Directory Access Protocol (LDAP) uses port 389 and Quick Mail Transfer Protocol uses port 209 by default.
Secondly, let’s talk about the protocols which use only User Datagram Protocol (UDP) Ports. Some of these protocols are given below:
There are also other protocol that uses UDP ports by default. One of the old but well-known routing protocols, Routing Information Protocol (RIP), uses UDP port 520 by default.
The other important protocol for clock synchronization, PTP (Precision Time Protocol). PTP uses UDP 319, 320 ports by default.
Now, 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.
There are also other application which use both of these protocols according to the need. Here, we have talked about some of these well-known protocols only.
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.