login about faq

Hi, actually i am programming a FTP upload routine for large files. Because the files might have up to 1GByte, the user should be able to interrupt transfer and to resume (continue) the transfer later.

My question: I coded it like described below, but when i reenter the code when resuming the transfer, the AsyncPutFileStart does nothing and terminates after a few seconds- so the transfer does not continue. What is wrong in my code- how do i have to code such a behaviour?

Thanks a lot!

My code:

//Async upload
bSuccess = ftp.AsyncPutFileStart(locFile,remFile);
if (bSuccess)
while (!ftp.get_AsyncFinished() && !(ptrThreadControl->ptrAbortTransfer)) { ptrThreadControl->ptrCurrentTransfered = ftp.get_AsyncBytesSent(); *ptrThreadControl->ptrCurRate = ftp.get_UploadRate(); Sleep(1000); }

if (ftp.get_AsyncSuccess()) { *ptrThreadControl->ptrCurrentTransfered = ftp.get_AsyncBytesSent(); } else {....}

asked Oct 23 '12 at 02:39

Guergele's gravatar image


edited Oct 23 '12 at 03:55

Gert's gravatar image

Gert ♦

It may help if you post the value of asyncLog - the async version of lastErrorText according to this example: http://www.example-code.com/vcpp/ftp_asyncUpload.asp


answered Oct 23 '12 at 03:56

Gert's gravatar image

Gert ♦

I tried to get the LOG but there was no last error! So what i found was that the Abort Flag was still set. -sorry for that stupid bug!

But meanwhile i implemented also the ftp.AsyncAbort in case my interruption flag is set. It does interrupt but now i have a strange behavour when i restart and complete the transfer: I want to transfer a 25MB file. When i interrupt at 10MB and restart transfer again it transfers me 15MB and signals "AsyncFinished" with success. But the file on the server is just 15MB and not 25MB.

Any Idea?

My code now: while (!ftp.get_AsyncFinished()) { ptrThreadControl->ptrCurrentTransfered = ftp.get_AsyncBytesSent(); ptrThreadControl->ptrCurRate = ftp.get_UploadRate();


        //User requests Abort
        if (*ptrThreadControl->ptrAbortTransfer)

answered Oct 23 '12 at 05:14

Guergele's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Oct 23 '12 at 02:39

Seen: 1,695 times

Last updated: Oct 23 '12 at 05:14

powered by OSQA