I have a connect that I give 20 seconds to for a timeout (slow link). I need to allow my user to cancel this connect call.
I already have the connect occurring in a thread so that I can keep the GUI going, but how do I tell Indy to cancel? I also have to call cancel from the main thread because the connect call is blocked. Is this possible?
This is for C++ Builder, but a Delphi answer will do just fine.
The only way to abort Connect() is to call Disconnect() from a different thread context than the one that is calling Connect(). In this situation, your main thread can call Disconnect() directly, and then your thread can handle the exception that Connect() raises in reply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With