Difference between TCP and UDP ?

Hello guys, in this article we will discuss about 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 OSI (Open System Interconnection) model. This is most widely used protocol in network. TCP stands just before to IP header. In simple terms, whenever a data packet encapsulate at layer 7 i.e. Application Layer, then it will first come to the Transport layer, where TCP Header is added to original data packet. After adding this header (i.e. TCP Header), this data is called Segment.

Before any transmission, TCP first establish a reliable connection among both sender and receiver using “Three Way-Handshake Process“. After that, the data transfer is start 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 send to sender. The next data bits or packets are only send if source device properly received acknowledged messages. Therefore, this protocol is known as Reliable Protocol.

TCP have ability to check errors present in Packets. If there is any errors present in data packet, TCP simply discard that packet and request to sender to send an error free data packets.

But, due to over load 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 unreliable transport layer protocol, which have no guarantees that whether the recipient will receive the data or not.  UDP don’t have any connection establishment process like Three Way Handshake in TCP protocol. Therefore, this protocol also known as 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 don’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 *