TCP vs. UDP

The transmission control protocol (TCP) consists of four different layers: the network layer, the link layer, the transport layer, and the application layer. Each layer sends a message to a specific port address and enables communication.

The user datagram protocol (UDP), on the other hand, is a connectionless internet protocol that allows communication between the server and the client.

svg viewer

Feature by feature comparison

The following table compares TCP and UDP in terms of specific features.

Feature TCP UDP
Reliability Yes No
Data loss No Yes
Data transfer speed Slow Fast
Header size 20 bytes 8 bytes
Error checking Yes Yes
Error recovery Yes No
Flow control Yes No

The most significant difference between the two protocols is that TCP only transfers data after the conformational response from the server has been received, while UDP transfers data without any response. This means that UDP is prone to data security threats ​while ​TCP is immune.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved