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 ofSolution 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.
精彩评论