TCP versus UDP


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 of TCP vs UDP 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 when we compare TCP vs UDP? 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.



Now, let’s talk about reliability and compare TCP vs UDP. 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? When we compare TCP vs UDP, 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.



TCP and UDP Application Ports

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:

  • Well-Known Ports ( 1 to 1024 )
  • Registered Ports ( 1025 to 49151 )
  • Private Ports ( 49152 to 65535 )


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. 



TCP Well-Known Ports

We have compared TCP vs UDP and we have learned the differences between these two protocols. Now, let’s do TCP vs UDP for 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:

  • FTP Data (Port 20)
  • FTP Control (Port 21)
  • SSH (Port 22)
  • Telnet (Port 23)
  • SMTP (Port 25)
  • TACACS (Port 49)
  • HTTP (Port 80)
  • POP3  (Port 110)
  • SFTP (Port 115)
  • HTTPS (Port 443)



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.

  • Gopher uses port 70
  • Finger uses port 79
  • Network News Transfer Protocol (NNTP) uses port 119
  • Internet Message Access Protocol (IMAP) uses port 143
  • Quick Mail Transfer Protocol uses port 209
  • Lightweight Directory Access Protocol (LDAP) uses port 389


UDP Well-Known Ports

Secondly, let’s talk about the protocols which use only User Datagram Protocol (UDP) Ports. Some of these protocols are given below:

  • DHCP & BOOTP Server (Port 67)
  • BOOTP User (Port 68)
  • TFTP (Port 69)
  • NTP (Port 123)
  • SNMP (Port 161)
  • SNMP Trap (Port 162)
  • Syslog (Port 512)
  • ISAKMP (Port 500)



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.



TCP/UDP Well-Known Ports

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.

In this lesson, we have compared the most improtant transport layer protocols, we have compared TCP vs UDP. To learn more about these transport layer protocols, you can also check the specific lessons of these protocols.



TCP and UDP Questions

Questions 1: How many bytes are there in an TCP and UDP Headers in order?

a) 4/16

b) 16/4

c) 8/20

d) 20/8

e) 8/16

Questions 2: When we compare TCP vs UDP, which one has no Handshake mechanism?

a) TCP

b) UDP

Questions 3: Which ones are True for TCP but not UDP? (Select 2)

a) There is no ACK mechanism

b) Secure transport protocol

c) Provide guaranteed transfer

d) Fast protocol

e) Has 8 bytes header

Questions 4: Which ones are True for UDP but not TCP? (Select 2)

a) Slow protocol

b) Secure transport protocol

c) No Reorder mechanism

d) There is no ACK mechanism

e) Has 20 bytes header

Questions 5: Which ones are Well-known ports range?

a) 1-1024

b) 1025-49151

c) 49152-65535

Answers: 1)d   2)b   3)b,c   4)c,d   5)a

Lesson tags: tcp, udp
Back to: CCNA 200-301 > TCP and UDP

Leave a Reply

Your email address will not be published. Required fields are marked *

CCNA 200-301