(Everyone cleans up. If you use TCP to transfer files, it is very simple. You don't have to worry about losing packets. Unless the network is broken, you have to start again. If you use UDP, because UDP is not reliable, you must write your own rated code to ensure that you will not lose packets when you use it to transfer files. This article talks about how to ensure reliable transmission.
Secure file transfer.doc with UDP)