aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes File upload/download using UDP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "File upload/download using UDP" Watch "File upload/download using UDP" New topic
Author

File upload/download using UDP

Maulin Rathod
Greenhorn

Joined: Dec 17, 2008
Posts: 11
Hi,

We have web based j2ee application which allows file upload/download. Due to latency issue upload/download is slower for many users.


1) I read that sending data using UDP can improve data transfer speed. How can we send file data using UDP?

2) We are zipping file using GZIP before upload/download to reduce amount data transfer. Is there better method available improve data compression?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18911
    
    8

Sure, UDP increases transfer speed. But it also reduces reliability. Do your users care if pieces of the transmitted file are missing? If they do (and I expect they would) then you are going to have to write code to make sure that all of the pieces of the file arrive at the target and are put back together in the right order. And to do this your code would essentially have to duplicate what TCP does anyway.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

If I could +2 Paul's post I would have. UDP does not guarantee that any packet arrives at its destination. It even allows everything to be dropped.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Maulin Rathod wrote:We are zipping file using GZIP before upload/download to reduce amount data transfer. Is there better method available improve data compression?

I think Bzip2 has better compression than Gzip on average, at the expense of longer compression/decompression times. A Java implementation is part of http://commons.apache.org/compress/, so you can easily try if it compresses your data better than Gzip.

Rob Spoor wrote:If I could +2 Paul's post I would have.

Glad I could be of assistance :-)


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File upload/download using UDP