Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i download a file in chunks.

 
salman shaikh yousuf
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
salman shaikh yousuf
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic