Solved

How to make a reliable file transfer program with UDP?

Posted on 2012-03-23
5
875 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
Comment Utility
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
Comment Utility
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 250 total points
Comment Utility
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
Comment Utility
You need to do your own sequence numbering and checksumming. You can use java.util.zip.CRC32
0
 

Author Closing Comment

by:errang
Comment Utility
Thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
return in catch statement 1 39
maven java path setting 5 49
Modeling a class in java 5 31
JDeveloper 12c for 32 bit 4 34
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 clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

763 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

11 Experts available now in Live!

Get 1:1 Help Now