aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes how can i download a file in chunks. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "how can i download a file in chunks." Watch "how can i download a file in chunks." New topic
Author

how can i download a file in chunks.

salman shaikh yousuf
Greenhorn

Joined: Mar 26, 2003
Posts: 2
i am developing a program that will work like GETRIGHT or DOWNLOAD ACCELERATOR PLUS
i want to write a code that will save the ipaddress and its downloaded percentage that has already been downloaded.
///////////
HAve each page/file on internet its own ip?
e.g. www.yahhoo.com = 190.0.0...or something
and www.yahoo.com\login.html = 190.0.0.1 other than www.yahoo.com.
please do help me.
thanku
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
I'm really not sure what you need here. Are you wanting to cache these pages? Are you wanting to cache multiple pages concurrently? Give us a little more info and maybe we can point you in a direction.
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
salman shaikh yousuf
Greenhorn

Joined: Mar 26, 2003
Posts: 2
sir i want to download files (all kinds eg .exe, .htm .html .swf setup files etc)
in chunks.
once i conect to internet for 15 minutes and i have downloaded 20% of the file and then next time connectivity 30% more total of 50%
thats what i want to do.
Download files in chunks/parts.
guide me how can i get info of file and what casses will be used?
Thanku for ur reply.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
So you want to connect to the internet, start downloading a file and if you lose your connection be able to resume the download after reconnecting? You could do that with plain sockets, but that wouldn't gain you any time because you would still have to skip the bytes already downloaded when you opened up the InputStream the second time. Those skipped bytes are still going to be in the pipe the second time around. So you are most likely going to have to use the FTP protocol and hope that the FTP server supports the RESTART (REST) command. You can find the white paper here RFC 959 on the full FTP protocol. This is the pertinent statement on the REST command:
RESTART (REST)
The argument field represents the server marker at which
file transfer is to be restarted. This command does not
cause file transfer but skips over the file to the specified
data checkpoint. This command shall be immediately followed
by the appropriate FTP service command which shall cause
file transfer to resume.
Michael Morris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can i download a file in chunks.