I'm doing an http request in its own thread, which waits for it to be finished (a 180 second timeout) or for the user to abort it.
Using the background mode, I expected to be able to abort the request. Even though I call BgTaskAbort, it hangs up trying to return from the function that creates the CkHttp object. It seems that the CkHttp destructor waits for the timeout to be finished before returning. The same thing happens if I use "new" to create the CkHttp object and "delete" to delete it -- it will not return from the "delete" call until the 180 seconds has elapsed.
Here's a code snippet:
So, am I doing something wrong? Is there any way around this?
I also tried making the CkHttp object static, which did let it leave the function immediately, but then when another request is made it would hang up (presumably waiting for the first one to time out).
Note: I am using a version from 2010. Tried to use the new version 9.5, but wouldn't compile without changes to my code (some of the Mail/MailMan functions changed, so I'm not ready to migrate yet. If this was a known bug that has since been fixed, let me know and I'll make the effort.
asked May 02 '16 at 10:37
You can try calling CkHttp.CloseAllConnections. I don't know if that would help.
Your code is using an older async scheme that was deprecated. It should changed to use the Chilkat standard for async (where each method that can be asynchronous has a corresponding method ending with "Async" and it returns a CkTask).
I don't know if the hangup was due to the older deprecated "Bg" methods, or if it was due to something else. I created a latest pre-release (v18.104.22.168) you can try here: http://www.chilkatsoft.com/download/preRelease/chilkat-9.5.0-x86-vc6.zip
answered May 04 '16 at 12:31
Thank you for the response.
I don't have the CloseAllConnections function, so that must have been added later. It sounds like my only option to fix this would be to use the newer version. It's just a pain to have to go through and change a bunch of code due to class API changes, hoping it still works the same way, and then have to re-test everything. (That's why I still use VC++ 6.0 -- I don't have the manpower to rewrite and re-test an entire system that has been fine-tuned and debugged over 15 years. ;-)
answered May 04 '16 at 13:55
I don't suppose there's a (brief) list somewhere that outlines changes that need to be done to migrate from one version to another? Like the MailMan function changes for attaching a file, etc, and how to convert the CkHttp Synchronous/Bg functions to the Async functions... The release notes (given the time to go through them) may tell me that something changed, but not how to convert my code as far as I've seen.
answered May 04 '16 at 14:13