03-04-2017, 03:33 PM
(This post was last modified: 03-05-2017, 09:09 AM by Rick Johnson.)
Looking through the header notes I found "Asynchronous InternetGET objects must be allocated using operator new" and wondered if the first line of this example allocated as if "new" was somehow implicit:
If I change this to add "new" then I get a syntax error that Async is not a type. I can't create an empty instance and then add the Async info later:
...because I cannot create an instance without including the parameters, and calling ->Async with the required parameters crashes at runtime. The example code first provided has worked well for me for both async POST and GET, but when a fluke at my web host caused a permissions error, all of my plugins crashed Illustrator in the HTTP call rather than fail gracefully as they did when the server was eventually shut down. I want to ensure that Async calls are done correctly, so any clarification would be very much appreciated.
Code:
this->ipChecker = hdi::core::InternetGET::Async(
"http://checkip.dyndns.com/",
HDI_CORE_CALLBACK(skel::Plugin, this, ipCheckSuccess),
HDI_CORE_CALLBACK(skel::Plugin, this, ipCheckFailure)
);
If I change this to add "new" then I get a syntax error that Async is not a type. I can't create an empty instance and then add the Async info later:
Code:
this->ipChecker->Async(...
...because I cannot create an instance without including the parameters, and calling ->Async with the required parameters crashes at runtime. The example code first provided has worked well for me for both async POST and GET, but when a fluke at my web host caused a permissions error, all of my plugins crashed Illustrator in the HTTP call rather than fail gracefully as they did when the server was eventually shut down. I want to ensure that Async calls are done correctly, so any clarification would be very much appreciated.