Difference between TCP and UDP ?

Hello guys, in this article we will discuss various differences between Transmission Control Protocol (TCP) and User Datagram (UDP) protocol.

tcp-vs-udp
TCP vs UDP

Some Common Things in Both TCP and UDP

Although, TCP and UDP are different protocols but they have some similarities. Both, TCP and UDP protocols are works on Transport Layer of OSI Reference Model. The Data from Application layer first interacts either with TCP or with UDP. Here, TCP or UDP encapsulate their header’s on this data to form a segment and then send this to IP protocol.

Transmission Control Protocol (TCP)

TCP stands for Transmission Control Protocol. It is one of the transport layer protocols. TCP protocol number is 6.

TCP protocol works on Layer 4 of the OSI (Open System Interconnection) model. This is the most widely used protocol in the network. TCP stands just before to IP header. In simple terms, whenever a data packet encapsulates at layer 7 i.e. Application Layer, then it will first come to the Transport layer, where TCP Header is added to the original data packet. After adding this header (i.e. TCP Header), this data is called Segment.

Before any transmission, TCP first establishes a reliable connection among both sender and receiver using “Three Way-Handshake Process“. After that, the data transfer is started between them. Therefore, this protocol is also known as Connection-Oriented protocol.

TCP basically guarantees the recipient will receive the data. Each time, whenever data bits, are transmitted from one end to another end, an acknowledgment message is sent to the sender. The next data bits or packets are only sent if the source device properly received acknowledged messages. Therefore, this protocol is known as Reliable Protocol.

TCP has the ability to check errors present in Packets. If there are any errors present in the data packet, TCP simply discards that packet and request to the sender to send an error-free data packets.

But, due to the overload of delivery and acknowledgment messages, the transmission speed is slow in comparison of UDP (User Datagram Protocol).

Protocols which use TCP : HTTP, HTTPS, FTP, Telnet, SSH.

User Datagram Protocol (UDP)

User Datagram Protocol (UDP) is another transport layer protocol. UDP protocol number is 17.

User Datagram Protocol (UDP) is an unreliable transport layer protocol, which has no guarantees whether the recipient will receive the data or not.  UDP doesn’t have any connection establishment process like Three-Way Handshake in TCP protocol. Therefore, this protocol is also known as a connectionless protocol.

UDP gives a high transmission speed between sender and receiver. Therefore, it is used in high-speed deserving applications likes Live Broadcasts and Telephonic conversations. As UDP doesn’t have error checking and correction mechanism, therefore, UDP is suitable for purposes where error checking and correction are either not necessary or are performed in the application.

Protocol which use UDP : DHCP, DNS.

Summary

TCP and UDP both protocols are widely used. TCP is connection-oriented, reliable but slow protocol. UDP is fast, unreliable and connectionless protocol. Both protocols have their own advantages and disadvantages. Some application layer protocols use TCP and some protocols use UDP.

Did you find this guide helpful?

Please, comment your views in comment box.

Leave a Reply

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