Solved

How to make a reliable file transfer program with UDP?

Posted on 2012-03-23
5
886 Views
Last Modified: 2012-03-24
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
Comment
Question by:errang
  • 3
5 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 37759741
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37759743
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 250 total points
ID: 37759749
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
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 37760398
You need to do your own sequence numbering and checksumming. You can use java.util.zip.CRC32
0
 

Author Closing Comment

by:errang
ID: 37761921
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Jpanels and Jframe 8 28
Adjust the position 3 49
Zip Folders Using Chilkat Routines 1 12
hibernate insert example 13 14
Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now