udp for large data file
I need to transfer a big data file (image file) using UDP protocol in Ja开发者_Python百科va. Any resources / links to do it will be helpful.
The main thing you will need is a layer to add reliability. http://www.google.co.uk/search?q=java+reliable+udp UDP is not reliable and any or all of the image could be lost unless you have a protocol on top of UDP to make it reliable.
I suggest you impliment this using TCP first as this is much simpler, and change it to UDP if you feel you still need to later.
Have a look at the trivial file transfer protocol (TFTP) - it implements a file transfer over UDP.
In real life, when not limited to UDP, you would use something TCP-based, as you have to implement everything again what TCP gives you over UDP, and most probably you would do this less efficient than your TCP-stack could have done.
精彩评论