From: DaveO on
Hi All

Using VB5 sp3

I am already using :
InternetOpen
InternetConnect
FTPopenFile
InternetReadFile
to download a file from a ftp site without any problems.

I am using the InternetReadFile in a loop so that I can keep track and
display progress of the number of bytes downloaded as I have already got the
exact size of the file being downloaded.

Sometimes I get an internet connection break and end up with only some of
the file downloaded and saved to my local file.

I want to be able to resume the download from where the break occured.
I am able to read the partially downloaded file ( from my local drive ) into
a buffer in chunks of 1000 bytes.

I need to start the download from the ftp site at position ' x '

for example:
already downloaded 50212 bytes
read from local file 50000 bytes ( ignore the 212 bytes at the end )
I need to start reading internet file from position 50001

BUT ... I can't get InternetSetFilePointer(hFile, Len(sBuffer), vbNull,
FILE_BEGIN, 0) to work.

Should this work with FTPopenFile ? is there another way of doing this ?

Thanks in advance for any ideas.

DaveO


From: Juergen Thuemmler on
> I am using the InternetReadFile in a loop so that I can keep track and
> display progress of the number of bytes downloaded as I have already got
> the
> exact size of the file being downloaded.

From MSDN:
Remarks
This function cannot be used once the end of the file has been reached by
InternetReadFile.
For HINTERNET handles created by HttpOpenRequest and sent by
HttpSendRequestEx, a call to HttpEndRequest must be made on the handle
before InternetSetFilePointer is used.

> Should this work with FTPopenFile ?

Yes.

Juergen.


From: DaveO on
Hey, after about 4 hours on google I found the way.

When using ....
InternetOpen
InternetConnect
FTPopenFile
InternetReadFile

I have to use the FTPcommand "REST" ( with the byte number to start at )
just BEFORE the FTPfileOpen command.

Regards
DaveO

---------------------------------------------------
"DaveO" <jsinvest(a)mweb.co.za> wrote in message
news:d02c26$iqb$1(a)ctb-nnrp2.saix.net...
Hi All

Using VB5 sp3

I am already using :
InternetOpen
InternetConnect
FTPopenFile
InternetReadFile
to download a file from a ftp site without any problems.

I am using the InternetReadFile in a loop so that I can keep track and
display progress of the number of bytes downloaded as I have already got the
exact size of the file being downloaded.

Sometimes I get an internet connection break and end up with only some of
the file downloaded and saved to my local file.

I want to be able to resume the download from where the break occured.
I am able to read the partially downloaded file ( from my local drive ) into
a buffer in chunks of 1000 bytes.

I need to start the download from the ftp site at position ' x '

for example:
already downloaded 50212 bytes
read from local file 50000 bytes ( ignore the 212 bytes at the end )
I need to start reading internet file from position 50001

BUT ... I can't get InternetSetFilePointer(hFile, Len(sBuffer), vbNull,
FILE_BEGIN, 0) to work.

Should this work with FTPopenFile ? is there another way of doing this ?

Thanks in advance for any ideas.

DaveO