Online Tutorials & Training Materials | STechies.com
Register Login
Advertisement

Difference between TCP and UDP with Comparison Chart

|| 0

Difference between TCP and UDP with Comparison Chart
Stechies

New users of TCP/IP are often left wondering with regards to the existence of two types of transport layer protocols- (TCP and UDP). As TCP is the more popular option among the two, it is common for most people to be curious about the features and functionality of UDP along with the differences between TCP and UDP. Through this article, we aim to explain the main points of difference between UDP and TCP, the reasons behind the usage of these two protocols, and why they are needed. We begin with a comparison chart depicting the main differences between UDP and TCP.

TCP vs UDP

Basis of Differentiation

TCP

UDP

Type of protocol

The protocol is connection-oriented.

The protocol does not have any connections.

Reliability of communication

The communication through TCP is reliable.

The communication through UDP is not reliable.

Type of connection implementation

TCP implements connectivity in the form of a stream of bytes travelling from source to destination.

UDP transmits independent packets referred to as datagrams that travel from source to destination.

Loss of data

There is no loss of data. The level of order of delivery is satisfactory.

Order of delivery is not guaranteed; neither is loss of data.

Importance of speed and reliability

In TCP, speed is not as important as reliability.

In UDP, reliability is less important than speed.

Size of header

The header size of TCP is 20 bytes.

The header size of UDP is 8 bytes.

Need for handshake

TCP follows a 3 – way handshake when a connection has to be established.

Handshake is not required as connections are not present in this protocol.

Mechanism in use

As reliability of communication is important in TCP, it utilizes error – detection as well as error – correction mechanisms in case of erroneous packets.

UDP does not incorporate error – checking and/ or no error – detection. A corrupt packet is discarded straight away.

Acknowledgement

In TCP, each byte has an acknowledgement. Given this, TCP is referred to as byte – stream protocol.

There is no acknowledgement in case of UDP.

Controls

Congestion control and flow control take place in TCP.

Congestion control and flow control are not present in UDP.

Sequence number

Bytes are assigned with sequence numbers.

No sequence numbers are needed for packets.

Examples

Making phone calls.

Online games.

Used for

TCP is useful for protocols like HTTP, SMTP, FTP, Telnet etc.

UDP is useful for protocols like DNS, RIP, VOIP, DHCP, SNMP, TFTP etc.

What is TCP?

TCP or Transmission Control Protocol ranks high on the list of primary protocols present in the Internet protocol suite. This connection – oriented protocol offers a reliable, free data communication flow between two computers. In effect, it means that all both way communication/ information has to reach from source to destination. Overall, TCP is a connection – oriented protocol.

  • TCP establishes seamless and error-free communication links between a destination port/IP address and a source port/IP address.
  • Both the destination and source port are tightly bound through this link till either the link is broken or the connection is terminated.
  • A telephone conversation is a striking example of connection – oriented protocol – the communication will take place and get terminated when the task has been performed.

What is UDP?

UDP refers to User Datagram Protocol; it is a connection less protocol. UDP transmits independent data packets known as datagrams from one computer to the next. As it fails to guarantee data arrival it cannot be termed as a reliable communication mode. UDP is useful for those who are not needy of strict reliable communication channels and believe that other protocols may give more overhead; in such places, UDP serves to be very useful. A good instance of UDP pertains to a clock server sending the current time to clients as and when requested.

UDP, an immensely lightweight protocol, has been defined in RFC 768. The main usage for UDP includes different kinds of service advertisements of the likes of server availability, routing protocol. one-to-several multicast applications, voice/video and other streaming applications, etc. wherein lost datagrams are not as important as the out-of-order datagrams.

Key Difference between UDP and TCP

The primary difference between TCP and UDP can be understood as below:

1.The UDP header of 8 bytes serves to be considerably smaller than TCP headers comprising of 20 bytes. UDP and TCP headers both contain destination port fields and 16 bits source, wherein the source port fields are used for replying to the message.

2.TCP and UDP protocols are known to use ports; users can have an application running on a system using TCP port 80 while another system uses UDP port 80.

Conclusion

In conclusion, it will suffice to say that TCP and UDP, two popular transport layer protocols, cannot be done without in any way. The selection between TCP vs UDP can be done via application developers and in line with user application connection requirements – take your pick!


Advertisement