I use Delphi 10.2 Tokyo with Indy (the integrated version).
Scenario: I do http GET requests (TIdHttp) in threads, and use proxies. Sometimes, a proxy seems to cause Indy not to timeout, and not to return from a GET. I also assign the onWork event handler to react to an Abort button and call within this handler the idHttp.Disconnect function. When the GET seems to be frozen, the abort also does not work, possible that in this case the onWork event is not triggered, I have no idea.
The main thread is idle and only create lets say 50 threads, each does a GET via its instance of TIdHttp. Ans sometiumes, as I mentioend, a proxy cause of GET not to return which result then in a "hanging" thread.
My question is: How can I force Indy to abort, from an external thread? Is there anything what can be done via code when the GET refuse to return?
ReadTimeoutassigned? Don't callDisconnectin theOnWorkevents. Raise an exception instead, like callingSysUtils.Abort. But if the connection is hung/blocked, theOnWorkevents won't be firing. Your main thread can directly callDisconnectto abort a blocking socket operation in progress in another thread, but that is not portable (it works on Windows, might not on other platforms) - Remy LebeauReadTimeoutshould work, assuming the connection is actually idle and not just sending data slowly. If it is not working, you will have to debug it to figure out why. callingDisconnectfrom a different thread is probably your best option. - Remy Lebeau