Difference between TCP and UDP?

TCP is a connection oriented stream over an IP network. It guarantees that all sent packets will reach the destination in the correct order. This imply the use of acknowledgement packets sent back to the sender, and automatic retransmission, causing additional delays and a general less efficient transmission than UDP.

UDP is a connection-less protocol. Communication is datagram oriented. The integrity is guaranteed only on the single datagram. Datagrams reach destination and can arrive out of order or don’t arrive at all. It is more efficient than TCP because it uses non ACK. It’s generally used for real time communication, where a little percentage of packet loss rate is preferable to the overhead of a TCP connection.

In certain situations UDP is used because it allows broadcast packet transmission. This is sometimes fundamental in cases like DHCP protocol, because the client machine hasn’t still received an IP address (this is the DHCP negotiaton protocol purpose) and there won’t be any way to establish a TCP stream without the IP address itself.

Leave a Comment