Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1037
  • Last Modified:

How to make a reliable file transfer program with UDP?

Hey,

      I'm trying to make a reliable file transfer program with UDP in Java, I realize that this is redundant because TCP sockets are available in Java, but this is a class assignment.

I made a simple program that sends UDP packets, but files kinda get messed up sometimes since UDP isn't reliable, is there a simple way to send name-value pairs with UDP?  So I can rearrange the file according to the sequence number?

Appreciate any help on this!
0
errang
Asked:
errang
  • 3
2 Solutions
 
for_yanCommented:
read this trail - it is based on C, not on Java but the recommednations at the bottom
which would allow to do error checking are in fact indoenddent of the language:

http://www.linuxforums.org/forum/programming-scripting/124839-how-optimise-file-transfer-through-udp-sockets.html
0
 
for_yanCommented:
0
 
for_yanCommented:
This is the plane form the link (the same I mentioned above)
http://www.linuxforums.org/forum/programming-scripting/124839-how-optimise-file-transfer-through-udp-sockets.html
 which I think gives
general scheme of making it reliable:


    Put a packet number in each packet.
    Add a checksum to each packet.
    Send an acknowledgement, and let it contain the packet number of the packet which has just been received.
0
 
CEHJCommented:
You need to do your own sequence numbering and checksumming. You can use java.util.zip.CRC32
0
 
errangAuthor Commented:
Thanks!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now