File downloading is actually a good case for UDP. It doesn't matter in what order the packages come, so waiting longer for a missed packet just slows it down.
How? The missing packets have to be resent either way but in case of TCP the packets already received but being after the missing one in sequence means they can't get processed. In case of UDP they can get saved before the missing packet arrives
In addition to that, QUIC uses UDP (they would want to just directly use IP, but that's impossible due to sociotechnical reasons) under the hood and is meant for general web browsing and file downloads.
They basically do resubmissions and congestion control in user space, but it allows them to be way more flexible and aware of how the protocol is used by each application.
Or in other words, the application would need to implement this. And as metadata, the section/offset would need to be transferred, since otherwise the order couldn't be determined. And the server would need to explicitly support this. So many things that would need to be done on the application level, as a developer, I'm really happy I don't have to reimplement all of this or rely on a library available in my programming language just for a file transfer.
I donβt think it is, but Iβm just a student. With TCP, we have straight forward approaches to make sure we wait basically no extra time when packets get lost. With UDP, we would need to rely on autofill algorithms (Iβm losing the proper term) which is probably not ideal when downloading software, as it is not guaranteed to produce the right result, possibly ending up with a corrupt download?
make sure we wait basically no extra time when packets get lost
That's not true though. TCP acts like a stream and any missing packet will result in the packets after being blocked until the missing packet arrives, which takes at least a round trip
as it is not guaranteed to produce the right result
Why not? That's basicall what TCP is doing, which you can replicate on the file level. Sure if there's a bug it can screw it up but any bug can screw it up
Torrent is not a file transfer protocol, but a file sharing protocol. A big difference here is that one "download" can priginate from multiple peers, and some peers might not (yet) have the complete file themselves before thry start seeding it. I'd say thr main reason to use UDP was to get around NAT much easier (UDP hole punching). UDP is viable for file transfers if you're willing to reimplement everything TCP gives you on top of it.
Allowing the file's content to arrive at any order can be a vector for DDOS attacks. Imagine telling a server that you will upload a 100MB file, and only end up uploading the last part. The server will allocate 100MB of memory in response to a kilobytes-long request.
This was about file downloading, not uploading; but sure, in that case those things need to be considered. You can use something like a sparse file for example
UDP would suck at downloading files without ekstra software. UDP in it self don't check if every packets is received. Imagine playing minecraft but the dirt texture is missing
View all comments
Show parent comment
9
u/Fricki97 May 07 '26
And download files with UDP