Is there a way that I can cancel a curl_easy_perform in C++??
I have a scenario where I am trying to connect to network resource that is offline and the curl_easy_perform take a certain amount of time before it returns CURLE_COULDNT_CONNECT. But in the meantime the user has closed the UI that wishes to connect and I want to immediatley cut off the curl connection and not have to wait for it to fail to connect.
I have tried storing the curl pointer that I use:
CURL *pEasy = curl_easy_init ();
And then while it is doing curl_easy_perform I called
curl_easy_cleanup(pEasy);
In an attempt to release or 'stop' the curl connection but it crashed and I got the following error from curl_easy_perform:
Unhandled exception at blah blah: Access violation reading location 0x00000004.
Is there a way I can cancel the connection attempt???? I have read this link: How can I immediately cancel a curl operation? but it seems to handle cancelling a curl connection after it has successfully connected.
EDIT - SOLUTION
I have found that if I call:
curl_easy_reset( pEasy );
Then
curlResult = curl_easy_perform ( pEasy );
returns almost immediately with the result CURLE_OPERATION_TIMEDOUT.
I think this is what I need :)