开发者

Fastest way to transfer a file over UDP

开发者 https://www.devze.com 2023-03-06 06:59 出处:网络
What\'s the fastest way to send a file over UDP? A) Create a large datagram for each chunk of the file, send that, and wait for a acknowledgement from the client before continuing

What's the fastest way to send a file over UDP?

A) Create a large datagram for each chunk of the file, send that, and wait for a acknowledgement from the client before continuing

B) Create a large datagram for each chunk开发者_StackOverflow中文版 of the file, send multiple (numbered) datagrams, and wait for an acknowledgement that all sections were received, then continue the transfer. If some were not received with 5 seconds, re-transmit those parts

C) Some other method I'm not yet aware of


Solution B is faster than A, but solution C is even more fast (and safe): try using TCP instead of UDP


Practically anything I can think of in (C) will be miles faster than either of them. Neither of them uses windowing, so they can't use all the available bandwidth-delay product. (B) is in fact a very poor piece of protocol design.

By the time you have added all the required features to UDP you have TCP. Use TCP.

0

精彩评论

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