TCP and UDP

The TCP and UDP are transport layer protocol that handle data communications between terminals in an IP network. The TCP is a connection oriented protocol and UDP is a connectionless protocol.

TCP

Transmission Control Protocol (TCP) tracked the packet transmission from source to destination. For example, sending a software file to someone or downloading a software from website make sure it is 100% delivered or downloaded. WhatsApp is another example of TCP, it is used TCP as transmission control protocol. It is not only informed the user about the receipt of the messages but also if those messages have seen and reproduced. The TCP, has three basic operations:-

  • Numbering and tracking segments transmitted to a specific destination from a specific application
  • Acknowledging received data
  • Retransmitting any unacknowledged data after a certain period

The understanding of difference between UDP and TCP is very important. Understanding of work procedure of each protocol as well as implementation of reliability features and how they track the conversation.

Establishing a Session

TCP is connection-oriented protocol which negotiates and establishes a permanent session between the source and destination devices earlier to forwarding any data. Throughout the session establishment, the devices check for the amount of traffic that can be forwarded at a specified time, and the communication data between the two can closely manage.

Reliable Delivery

It is possible for a segment to become corrupted or lost, as it transmitted over the network. The reliability ensures each sending segment must arrive at the destination.

Same-Order Delivery

Data can arrive in the wrong order due to multiple routes on the network with different transmission rates and speed. TCP make sure resembling the segments back into the correct order using numbering and sequencing.

Flow Control

The TCP provides flow control between the source and destination host. The flow control ensures the data rate at which a sender is transmitting. It ensures the data sending speed according to the speed of the receiver’s receiving capabilities. It is used to manage the flow of data/packets among two different nodes; especially in cases where the sending device can send data faster than the receiver can take in.

UDP

User Datagram Protocol (UDP) is a connectionless protocol and unreliable protocol. It is no guarantee to get its destination. Sending a non-registered letter or postcard to someone is the example of User Datagram Protocol, where you put it in the postbox. Now you are no information about the status of the letter or postcard because you don’t know about the availability of the receiver to receive the letter and chances are good that it will get where it’s supposed to go but there is no guarantee.

There is a possibility of loss in the way. The post office is not responsible for tracking the letter or informing the sender if the letter does not arrive at the destination. The User Datagram Protocolis working Just like the above example.

User Datagram Protocol provides basic functions for delivering data segments between the right applications, with very tiny overhead and data checking. The User Datagram Protocolis no acknowledgment of the receiving data at the destination. There are no transport layer processes that inform the sender of a successful delivery using UDP. While the TCP reliability functions give more dynamic communication among applications, they also gain extra overhead and possible delays in transmission.

UDP Features

UDP is a best-effort, lightweight transport protocol offers the same data segmentation and reassembles as TCP, but with no TCP reliability and flow control. The feature of UDP as:-
No Ordered Data Reconstruction – Data is reconstructed according to its receiving order.
Unreliable Delivery – Any lost segments has not resent in this protocol like TCP.
Connectionless – No session established with the source and destination.
No Flow Control – Does not inform the sender about the resource availability.

UDP Header

UDP does not inform the source and destination about the packets receiving. It also provide any state of the communication session to client and server. The UDP application is responsible for the reliability and can accept some loss of data during transmission over the network, but delays in transmission are unacceptable. The UDP application required less network overhead like UDP as protocol. It is preferable for streaming live audio, live video, and Voice over IP. The UDP header called datagrams, as shown in the figure below. The transport layer protocol sent these datagrams as best-effort.

UDP