Discussion:
How to download a large file in small pieces?
(too old to reply)
Cameron Fitzhugh
2006-10-22 11:06:23 UTC
Permalink
There's a large file at an ftp site (I tried accessing the directory with
http://..., but it isn't accessible through http) and at first I tried to
use InternetSetFilePointer to restart the download, but that didn't work,
and later I noticed that MSDN says this function only works with HTTP:

hFile [in] Handle returned from a previous call to InternetOpenUrl
(on an HTTP or HTTPS URL) or HttpOpenRequest (using the GET or HEAD
HTTP verb and passed to HttpSendRequest or HttpSendRequestEx).
This handle must not have been created with the INTERNET_FLAG_DONT_CACHE
or INTERNET_FLAG_NO_CACHE_WRITE value set.

So, is there any way to download part of a file via an FTP connection and
then later restart the download where you left off?

Thanks,
Cameron
Vladimir Scherbina
2006-10-24 15:12:12 UTC
Permalink
Cameron,

Wininet library does not support resume for FTP protocol(it's bad, I know).
I noticed it when disassembling FARFTP.DLL library - an extension for Far
program (http://farmanager.com/). The FARFTP.DLL implements FTP protocol 'by
hands', i.e. there is no calls to Wininet, etc. The 'REST' commands solves
the problem you get ... Read these articles:

1. http://www.codeproject.com/internet/pauseresume.asp
2. http://www.codeproject.com/useritems/ftpresume.asp

HTH
--
Vladimir
Post by Cameron Fitzhugh
There's a large file at an ftp site (I tried accessing the directory with
http://..., but it isn't accessible through http) and at first I tried to
use InternetSetFilePointer to restart the download, but that didn't work,
hFile [in] Handle returned from a previous call to InternetOpenUrl
(on an HTTP or HTTPS URL) or HttpOpenRequest (using the GET or HEAD
HTTP verb and passed to HttpSendRequest or HttpSendRequestEx).
This handle must not have been created with the INTERNET_FLAG_DONT_CACHE
or INTERNET_FLAG_NO_CACHE_WRITE value set.
So, is there any way to download part of a file via an FTP connection and
then later restart the download where you left off?
Thanks,
Cameron
Loading...