Xsmael
Xsmael

Reputation: 3962

In a congested LAN, does UDP send faster than TCP?

I have a real-time application (C++ using websockets) that has to communicate through a congested LAN. Because it's realtime, delays can't be tolerated. Will UDP perform better than TCP in this case?

I cannot tolerate packet loss, but can address it through retries if using UDP.

Upvotes: 2

Views: 1643

Answers (1)

Malt
Malt

Reputation: 30335

In a congested network UDP will send its packets faster than TCP. This is because TCP actively tries to avoid overloading the network using a mechanism called congestion control. UDP has no such mechanism; its send speed is limited only by the resources of the sender.

If your first priority is to just send the packets, then UDP is the way to go. However, your probably also want them to arrive at the other end, which is a separate problem.

Sending UDP packets into a congested network at a high rate will only cause it to become more congested, leading to long delays and packet loss.

The problem here is neither TCP nor UDP - but the congested network. If the road is congested, it doesn't matter whether you're driving a car or a bus, you'll be late either way.

So, it doesn't matter all that much which protocol you choose. To send something quickly over a congested network you need a solution at the network level, possibly some QoS mechanism to prioritize some packets over others. QoS can give you the network equivalent of bus lanes that allow buses to quickly pass congested roads at the expense of other traffic.

Upvotes: 4

Related Questions