#1 2024-07-31 15:35:40

sayencrusher
Member
Registered: 2024-07-31
Posts: 7

How to Properly Cancel a Download Using THttpClientSocket's WGet Funct

Hello everyone,

I'm working on a downloader for large files using the `THttpClientSocket` client and its `WGet` function, inspired by the mORMot2 `mget` tool. The downloader works fine with tuned parameters, but I'm facing an issue canceling a download mid-process.

I've tried calling `client.close` to interrupt the download, but it doesn't seem to stop the download as expected. Could anyone guide me on the correct workflow to cancel a download, dismiss the cache, and prevent the download from continuing?

Any advice or suggestions would be greatly appreciated.

Thank you!

Offline

#2 2024-07-31 16:47:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,548
Website

Re: How to Properly Cancel a Download Using THttpClientSocket's WGet Funct

Do you want to cancel the Download from another thread?

Try the new client.Abort method.

Offline

#3 2024-08-01 07:01:35

sayencrusher
Member
Registered: 2024-07-31
Posts: 7

Re: How to Properly Cancel a Download Using THttpClientSocket's WGet Funct

Thanks for your response, I am using the latest stable version and I can not find an abort function associated to the THttpClientSocket client, do you mean I should go to the newer versions?

https://github.com/synopse/mORMot2/rele … 2.2.stable

Offline

#4 2024-08-01 09:45:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,548
Website

Re: How to Properly Cancel a Download Using THttpClientSocket's WGet Funct

Yes, as I wrote this is a new method, not available in "stable".

You can use today's trunk for instance.
This version seems stable:
https://luti.tranquil.it/listfolder/48a … f8f0df2022

Offline

Board footer

Powered by FluxBB