Signup/Sign In
LAST UPDATED: MARCH 31, 2021

TCP Vs UDP: Difference Between TCP and UDP Protocol

Technology #TCP#UDP#Networking

    Have you ever come across the terms TCP and UDP and are wondering what they are, what is the difference between these two. If yes, then this article is for you. In this article, we will discuss what is TCP, what is UDP, what is the difference between these two, and many more.

    So let's get started.

    What is TCP?

    The term TCP stands for Transmission Control Protocol. TCP is used for good and reliable communication between two computers. It basically defines how to establish and maintain the networks so that the application program can exchange the data. When TCP works with the IP(Internet Protocols), it tells us how the computer sends the data packets to each other. It is widely used for organizing data that ensures secure transmission between the server and the clients. As it guarantees the transmission of data irrespective of the amount, therefore it is highly preferred.

    Some of the important features of TCP are:

    • It provides an error-checking and recovery mechanism.
    • It delays transmission when the network is congested.
    • It provides flow control and quality service.
    • Delivery Acknowledgment.
    • It provides end-to-end communication.
    • It is a reliable protocol.

    How TCP works?

    TCP is a Connection-oriented protocol that establishes the connection before transmitting the data and closes the connection after transmitting the data. Firstly, a connection is established then the application data is broken down into packets such that the networks can deliver, send to, and receive the data packets from the network layer. Moreover, it also handles retransmission of dropped or lost packets and acknowledges all the packets that arrive. Once the data transmission is done connection is closed.

    The below diagram shows the working of TCP.

    What is UDP?

    The term UDP stands for User Datagram Protocol. It is very much similar to TCP as it is also used for sending and receiving data. But the major difference between TCP and UDP is that, unlike TCP, UDP is not a connection-oriented protocol rather it is a connection-less protocol. It is also known as fire and forget protocol as it doesn't guarantee the delivery of data packets and also it does not care whether the data packet has been received by the receiver or not. Since it doesn't provide any assurance for the delivery of packets so it is faster than TCP.

    Some of the important features of UDP are:

    • UDP is faster than TCP.
    • There is a high possibility of data loss.
    • It allows small transactions
    • There is no acknowledgment of delivery.
    • It is used for DNS and NFS
    • It provides connectionless and unreliable service.

    How does UDP work?

    Like other networking protocols, UDP is also used to transfer data between two computers. Unlike TCP, UDP doesn't establish a connection first, it directly sends the data packet to a targeted computer without maintaining any order. It also doesn't acknowledge whether it has received the data packet or not. So, in UDP there is no tracking connection, ordering of messages, etc. Moreover, it also assumes that error checking and correction are not important and hence avoids these features.

    The below diagram shows the working of UDP.

    Key Difference Between TCP and UDP Protocol

    These are the following key difference between TCP and UDP:

    1. TCP is a Connection-oriented protocol that establishes the connection before transmitting the data and closes the connection after transmitting the data whereas UDP is a connection-less protocol.
    2. TCP rearranges data in a specific order whereas UDP doesn't maintain any order.
    3. UDP is faster than TCP.
    4. The size of TCP is 20 bytes whereas the size of UDP is 8 bytes.
    5. It follows the flow control mechanism where too much data cannot be sent to the receiver at the same time whereas UDP does not follow any such protocol.
    6. TCP performs error checking by using a checksum mechanism whereas UDP does not follow error checking.
    7. Retransmission of lost packets is possible in TCP whereas it is not possible in the case of UDP.
    8. TCP is heavyweight whereas UDP is lightweight.
    9. TCP doesn't support broadcasting whereas UDP supports broadcasting.
    10. TCP is used by HTTP, HTTPS, Telnet, etc whereas UDP is used by DNS, SNMP, etc.

    Comparison Chart: TCP Vs UDP

    Let us summarize the above-discussed points in a tabular form.

    TCP

    UDP

    It stands for Transmission Control Protocol.

    It stands for User Datagram Protocol.

    It is a connection-oriented protocol.

    It is a connectionless protocol.

    It is slower than UDP.

    It is faster than TCP.

    TCP is heavyweight.

    UDP is lightweight.

    TCP doesn't support broadcasting.

    UDP supports broadcasting.

    TCP is used by HTTP, HTTPS, Telnet, etc

    UDP is used by DNS, SNMP, etc

    TCP performs error checking by using a checksum mechanism.

    UDP does not perform error checking.

    The size of TCP is 20 bytes.

    The size of UDP is 8 bytes.

    Retransmission of lost packets is possible in TCP

    Retransmission of lost packets is not possible in UDP

    TCP rearranges data in a specific order.

    UDP doesn't maintain any order.

    TCP follows the flow control mechanism.

    UDP does not follow any such protocol.

    Conclusion

    Here, in this article, we discussed what is TCP, what is UDP, their features, working, and their differences. And I hope from the above discussion it is clear how the TCP differs from UDP.

    Also Read: Difference between OSI and TCP/IP Reference Model

    I am the founder of Studytonight & Fullstack developer (MERN). I like writing content about ReactJS, MERN, JavaScript, Docker, Linux, PHP, Go lang, Cloud, Web development, and general Tech related content. I have 10 years of diverse experience in software development.
    IF YOU LIKE IT, THEN SHARE IT
    Advertisement

    RELATED POSTS