开发者

TCP vs UDP throughput

开发者 https://www.devze.com 2023-04-12 00:35 出处:网络
Suppose we have tcp and udp connection over th开发者_如何学Ce same link of capacity C . Tcp has transfer rate of C whereas UDP has 8C as its transfer rate . Which will be more efficient ?Theoretically

Suppose we have tcp and udp connection over th开发者_如何学Ce same link of capacity C . Tcp has transfer rate of C whereas UDP has 8C as its transfer rate . Which will be more efficient ?


Theoretically, if nothing on the way happens to any of the packets, UDP would be faster. UDP doesn't require to acknowledge every packet like TCP does (ACK Flag). Also, no handshake and no connection tear-down is required. UDP would be the faster choice in an ideal network, where no packets get dropped.

The problem is, in a real world example, UDP would lose packets. You would be slower, because you would have to implement a packet control like in TCP in UDP too. UDP does not acknowledge the receival of packets, and it also does not knock on the door to see if anybody is home (TCP SYN). UDP Packets are easier structured than TCP packets, but sacrifice security for their size. http://www.diffen.com/difference/TCP_vs_UDP describes the differences.

So for your example. With a cable that can hold C packets/s, and TCP at a rate of C packets/s and UDP at a rate of 8*C packets/s, UDP would be much faster.

0

精彩评论

暂无评论...
验证码 换一张
取 消