TCP versus UDP

TCP vs 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 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-vs-udp-comparison-ipcisco.com

tcp-versus-udp

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.

 


 

TCP and UDP Application Ports

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:

  • 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

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:

  • 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)

protocols-uses-tcp-ports-ipcisco

 


 

UDP Well-Known Ports

Now, 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)

udp-only-ports-ipcisco

 


 

TCP/UDP Well-Known Ports

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.

 

Lesson tags: tcp, udp
Back to: HCNA (HCIA-Datacom) > TCP and UDP

Leave a Reply

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

HCNA (HCIA-Datacom)

Collapse
Expand
Latest Blog Posts