Difference between TCP and UDP. Explained!

TCP and UDP are the transport layer protocol which are the main core protocols of Internet Protocol(IP) suite. TCP(Transmission control protocol) is a connection-oriented protocol means data can be sent in any direction once a connection is established between the sender and the receiver.

UDP is a connectionless protocol. This protocol does not need to establish an end to end connection prior to sending packets to the receiver. Multiple messages are sent as packets in chunks using UDP.

The difference between TCP and UDP.


Reliability and connection: TCP is connection-oriented protocol. When a file or message send it will get delivered unless connections fail. If connection lost, the server will request the lost part. There is no corruption while transferring a message.Reliability and connection: UDP is connectionless protocol. When you a send a data or message, you don’t know if it’ll get there, it could get lost on the way. There may be corruption while transferring a message.
Usage: TCP is suited for applications that require high reliability, and transmission time is relatively less critical.Usage: UDP is suitable for applications that need fast, efficient transmission, such as games.
Transfer speed: The speed for TCP is slower than UDP.Transfer speed: UDP is faster because error recovery is not attempted.
Ordered: Order in which data is send is maintained in this protocol. One doesn’t have to worry about data arriving in the wrong order.Ordered: No ordering of data is maintained in this protocol. If you send multiple data packets, you can never predict which will reach first and which will reach later.
Heavyweight: TCP is heavy-weight. TCP requires three packets to set up a socket connection before any user data can be sent. TCP handles reliability and congestion control.Lightweight: No ordering of messages, no tracking connections, etc. It’s just fire and forgets! This means it’s a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.
Header Size: TCP header size is 20 bytesHeader Size: UDP Header size is 8 bytes
Streaming: Data is read as a “stream,” with nothing distinguishing where one packet ends and another begins. There may be multiple packets per read call.Datagrams: Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call.
Protocol which uses TCP: HTTP, HTTPs, FTP, SMTP, TelnetProtocol which use UDP: DNS, DHCP, TFTP, SNMP, RIP, VOIP.
  • Add Your Comment