Archived Forum Post

Index of archived forum posts

Question:

c++ FTP2 Upload Percent

Jun 14 '17 at 18:35

I have set the following:

_ftp.put_EventCallbackObject(&_ftpProgress);

_ftp.put_Hostname(_host.c_str());
_ftp.put_Username(_user.c_str());
_ftp.put_Password(_password.c_str());

_ftp.put_Passive(false);
_ftp.put_HeartbeatMs(250);
_ftp.put_SendBufferSize(4096);

But i am never getting calls to my FtpPercentDone method. Only AbortCheck


Answer

The percent-done event callbacks in v9.4.1 have been standardized to be named "PercentDone". Also take care to use "int" instead of "long" for the integer argument. See the CkFtpProgress.h --

    // Changed from "FtpPercentDone" to "PercentDone"
    virtual void PercentDone(int pctDone, bool *abort) { }
    //virtual void FtpPercentDone(long pctDone, bool *abort) { }


Answer

We seem to be having a similar problem with FtpPercentDone. Our original license was for the VC6 libraries - we tested new ChilKat libraries with 2017 and will be moving to that license. However we still have one legacy application that uses vs2008 and when it is compiled with the vc6 libraries we never get a call back in the FtpPercentDone method. Unicode, Multibyte, MT, DLL,

void FtpPercentDone (long pctDone, bool abort) void FtpPercentDone (int pctDone, bool abort)

ftp.GetFile2 (ckRemoteFileName, ckLocalFileName, myProgress))

ftp.put_EventCallbackObject (&myProgress); ftp.GetFile (remoteFileName, localFileName))

no combination of libraries, method calls, etc. will ever fire an event back to FtpPercentDone?

Any help would be sorely appreciated...

Tks, Mike


Answer

Got it to work .. not sure why but with new compiler it seems the method:

ftp.put_AutoGetSizeForProgress (true);

must be called before percent callbacks are issued..??


Answer

I think you're confusing the version of VC++ vs. the version of Chilkat.

Each new version of Chilkat is released for all versions of VC++. For example, Chilkat v9.5.0.68 can be used on VC6, VC9, VC2017, etc.

If you're using an ancient version of Chilkat (such as v9.4.1), then the callback method was named "FtpPercentDone".

If you're using a version of Chilkat since then, regardless of VC++ version, then the callback method is named "PercentDone". The callback mechanism is based on overriding a virtual method in a base class. Your application will define a class that derives from CkFtp2Progress, which is defined in CkFtp2Progress.h. If you examine the CkFtp2Progress.h header, you'll see that it's derived from CkBaseProgress (defined in CkBaseProgress.h). One of the virtual methods in CkBaseProgress.h is:

virtual void PercentDone(int pctDone, bool *abort) 

Your application's progress callback class would include a method to override it.


Answer

Tks for the quick answer. Makes sense...

True - we are in a bit of a version ^^&())* purgatory at the moment. We bought the original ChilKat license back when punch-cards where just coming into vogue... I think the ChilKat version was somewhere around .. 0.00001. :)

If we have a license that was originally bought for the v9.4 libraries will it work with newer versions?

One thing I can say for sure - we have beat the ChilKat software for years and it just holds up. If we could only get the government to be as efficient we could all be coding on our yachts...

Tks, agsin.. good company, good people.. Mike


Answer

Tks for the quick answer. Makes sense...

True - we are in a bit of a version ^^&())* purgatory at the moment. We bought the original ChilKat license back when punch-cards where just coming into vogue... I think the ChilKat version was somewhere around .. 0.00001. :)

If we have a license that was originally bought for the v9.4 libraries will it work with newer versions?

One thing I can say for sure - we have beat the ChilKat software for years and it just holds up. If we could only get the government to be as efficient we could all be coding on our yachts...

Tks, again.. good company, good people.. Mike