Difference Between TCP and UDP in Tabular form

Both UDP and TCP are transport layer protocols. The main difference between TCP and UDP is, TCP is a connection-oriented protocol, whereas UDP is connection-less. In other words, TCP needs to establish a connection prior to data transfer whereas UDP doesn’t.

Difference between TCP and UDP

What is Transport Layer?

TCP and UDP both are the protocols used in Transport layer that facilitates data exchange between source and destination host.

Transport layer enables multiple applications to use single dedicated network connections simultaneously and responsible for transmitting messages over the network .

It generates ports in order to allow applications running on the system to use them to connect themselves.

How does Transport Layer work?

When an application sitting at application layer sends a message to other host on the network, the message is handed over to transport layer where that particular message or data wrap inside a segment which consists additional information such as source and destination. After a segment is created, it is passed on to the network layer for further processing.

At the receiver end, the segment is accepted by the network layer and further delivered to the transport layer.

In the Transport layer, the actual message is unpacked and passed to respective application port specified in the segment.

Difference between TCP and UDP in Tabular form:

BasisTCPUDP
DefinitionIt establishes and maintain a dedicated connection before data transmission between hostsit doesn't require to establish and maintain any dedicated connection prior to data transmission between hosts
Full formTransmission Control ProtocolUser Datagram Protocol
Connection typeConnection-oriented protocolConnection-less protocol
Header Size20 Bytes8 Bytes
Congestion controlIt delays the data transmission when the network is congested which minimises the packet lossDon't support congestion control
OverheadInvolves high overhead such as acknowledgement, data retransmission and moreInvolves low overhead
Delivery acknowledgementWhen data packet is sent to destination host, it response back with an acknowledgement that is, it has received that dataNo such feature is exist in this protocol
Packet retansmissionWhen no acknowledgement is received within a specific time period, it assumes packets are lost and resend them againNo such feature is exist in this protocol
Conceptually Known asSteam-orientedmessage-oriented
OrderingSegment are numbered as a result it is received at destination in same sequence in which they are sentMessage sequence is not maintained
SpeedSlowFast
ReliabilityIt is reliableIt is not reliable
Connection EstablishmentConnection must be established. It uses 3 way Handshake to achieve thisData is sent without connection establishment
Also refer toHeavy-weight protocolLight-weight protocol
Packet drop rateVery LowHigh
Error Control MechanismChecksum, Acknowledgement, RetransmissionChecksum . However, it is not mandatory
Flow controlSliding window is used for flow controlNo such feature is exist in this protocol
Used byHTTP,SMTP and FTP are some examplesDNS and VoIP are some examples
Suitable forApplications that require high reliability, and transmission time can be compromisedApplications that require timely data transmission and reliability or packet drops can be compromised

TCP (Transmission Control Protocol )

Transmission Control Protocol is more reliable than UDP. It is a connection-oriented protocol that means it establishes and maintains a dedicated connection before data transmission.

This process is called 3-way handshake.
-> Makes a request to a server for connection setup
-> Server responses back to the client and when the client receives the response
-> Client sends the packet to server that acknowledges that connection has been established.

For closing the connection, it follows a similar procedure.

TCP is steam-oriented which means that an application sends data in a continuous flow of data and it doesn’t have control on data splitting. for example, Phone calls.

Segment enclosing the data are numbered, therefore, TCP assures the sequence of messages or data must be delivered in the correct order to the destination host.

TCP supports several features. Some of these are :

Delivery acknowledgement:- When a data packet is sent to the destination host, it responds back with an acknowledgement that is, it has received that data.

Packet retransmission: When a sender doesn’t receive a delivery acknowledgement within a certain amount of time, it assumes that the packet is lost and send the packets again.

Congestion control: It delays the data transmission when the network is congested which minimises the packet loss.

Drawbacks of using TCP

  • It uses a bigger header of 20 bytes
  • It doesn’t send out immediately which delays the transmission
  • It involves high overhead such as acknowledgement, data retransmission and more.

UDP( User Datagram Protocol )

UDP has a smaller packet size than the TCP, having header size 8 bytes.It is a connection-less protocol which means it doesn’t require to establish and maintain any dedicated connection prior to data transmission.

It provides more control over the way in which data should be sent.

However, data corruption is common on a network, UDP uses a primitive form of error detection which is backed with checksum but this technique is not reliable. Therefore, it is difficult to recover data even after error detection.

It sends data once only and therefore, any loss of data is not counted. It also doesn’t guarantee in which order packed would be delivered, meaning it is not necessary to receive data in the same order as it sent from the source.

There is also no congestion control in UDP, meaning no matter how busy the network is, it would send data continuously, that triggers packet drops.

UDP is lightweight but not reliable. It is message-oriented which means application send their data on distinct chunks, such as email.

Key Differences:

  1. TCP stands for Transmission Control Protocol, whereas; UDP stands for User Datagram Protocol.
  2. TCP is connection-oriented, whereas; UDP is a kind of type of protocol which is connection-less or datagram oriented.
  3. In TCP, there is a primary requirement for setting up the connection between the sender and the receiver and then only the transmission of data is proceeded, while, in UDP protocol, a broadcast mechanism is used for transmitting information, result in the requirement of establishing the connection between the sender and receiver is not needed.
  4. In TCP protocol when it comes to reliability, the TCP protocol gives cent percent guarantee of delivering the data to its respective destination, whereas; in UDP protocol as there is no connection maintained.
  5. In TCP protocol when it comes to error checking, the TCP protocol provides a full-fledged set of advanced error checking methods and mechanisms, whereas; in UDP protocol the error checking is very nominal and reduced to a minimum and basic error checking methods and mechanisms.
  6. TCP protocol transmits the data in the proper order, whereas; in UDP protocol the data is not sequenced.
  7. The TCP protocol is feature loaded and very secure which makes it very heavyweight, whereas, the UDP protocol has minimal features which make it very lightweight.
  8. In TCP protocol, there is a header size of about 20 bytes, whereas; in UDP protocol, there is a header size of about 8 bytes.

Leave a Reply