Differences between TCP and UDP

Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) both are protocols of the Transport Layer. TCP is a connection-oriented protocol where as UDP is a part of the Internet Protocol suite, referred to as the UDP/IP suite. Unlike TCP, it is an unreliable and connectionless protocol.

Where do we use TCP and UDP in real life?


TCP is one of the main protocols of the Internet protocol suite. Between Application and Network Layers which are used in providing reliable delivery services.It helps in the exchange of messages between different devices over a network since its connection oriented protocol. The Internet Protocol (IP), which establishes the technique for sending data packets between computers, works with TCP.

This is why real-time applications like audio and video streaming will often use UDP.

Features of TCP

  • TCP keeps track of the segments being transmitted or received by assigning numbers to every single one of them.
  • Flow control limits the rate at which a sender transfers data. This is done to ensure reliable delivery.
  • Its implements an error control mechanism for reliable data transfer. TCP takes into account the level of congestion in the network.

Advantages and Disadvantages of TCP

  • TCP is reliable for maintaining a connection between Sender and Receiver.
  • TCP  is responsible for sending data in a particular sequence.
  • TCP operations are not dependent on OS.
  • TCP  allows and supports many routing protocols.
  • TCP can reduce the speed of data based on the speed of the receiver.
  • It is slower than UDP and it takes more bandwidth.
  • Slower upon starting of transfer of a file.
  • It does not have a multicast or broadcast category.
  • It does not load the whole page if a single data of the page is missing.

User Datagram Protocol (UDP)

UDP is a Transport Layer protocol. UDP is a part of the Internet Protocol suite, referred to as the UDP/IP suite. Unlike TCP, it is an unreliable and connectionless protocol. So, there is no need to establish a connection before data transfer. The UDP helps to establish low-latency and loss-tolerating connections establish over the network. The UDP enables process-to-process communication.

Features of UDP

  • Used for simple request-response communication when the size of data is less and hence there is lesser concern about flow and error control.
  • It is a suitable protocol for multicasting as UDP supports packet switching.
  • UDP used in RIP(Routing Information Protocol).
  • Normally used for real-time applications which can not tolerate uneven delays between sections of a received message.

Advantages of UDP

  • UCP does not require any connection for sending or receiving data.
  • Broadcast and Multicast are available in UDP.
  • It can operate on a large range of networks. It has live and real-time data.
  • UDP can deliver data if all the components of the data when its not complete.

Disadvantages of UDP

  • We can not have any way to acknowledge the successful transfer of data.
  • UDP cannot have the mechanism to track the sequence of data than TCP
  • UDP is connectionless, and due to this, it is unreliable to transfer data.
  • In case of a Collision, UDP packets are dropped by Routers in comparison to TCP.
  • UDP can drop packets in case of detection of errors compare to TCP.

Which Protocol is Better: TCP or UDP?

In general, both TCP and UDP are useful in the context of the work assigned by us. Both have advantages upon the works we are performing, that’s why it is difficult to say, which one is better.

The answer to this question is difficult because it totally depends on what work we are doing and what type of data is being delivered.

UDP is better in the case of online gaming as it allows us to work lag-free. TCP is better if we are transferring data like photos, videos, etc. because it ensures that data must be correct has to be sent.

Which is faster: TCP or UDP?

Suppose letter has sent from Host 1 to Host2 . But there is a river in between those two houses. Now how can we send the letter?
Scenario  1:  Make a bridge over the river and then it can be delivered.
Scenario  2: Get it delivered by a pigeon.

  • Consider the first solution as TCP. A connection has to be made (bridge) to get the data (letter) delivered. The data is reliable because it will directly reach another end without loss of data or error.
  • The second solution is UDP.Connection less protocol . The process is fast as compared to TCP, where we need to set up a connection(bridge).
  • Reliable

UDP is faster than TCP.  Why TCP is faster the reason for the faster UDP is its non-existent acknowledge packet (ACK). It allows the streaming of continuous packets where as TCP always works on the acknowledgment of a set of packets calculated with the help of TCP window size and RTT.

Where TCP is Used?

  • TCP :  This is the best example of Sending Emails
  • TCP : Transferring Files
  • TCP : Web Browsing

Where UDP is Used?

  • UCP example : Gaming
  • UCP example :Video Streaming
  • UCP example :Online Video Chats

In this documents we have seen how TCP and UCP works .Also Difference between TCP and UDP.

Leave a Reply