# Asynchronous downloading using TCastleDownload for Delphi

**URL:** https://forum.castle-engine.io/t/asynchronous-downloading-using-tcastledownload-for-delphi/970
**Category:** News
**Created:** [November 5, 2023, 12:50pm UTC](https://forum.castle-engine.io/t/asynchronous-downloading-using-tcastledownload-for-delphi/970 "2023-11-05T12:50:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [November 5, 2023, 12:50pm UTC](https://forum.castle-engine.io/t/asynchronous-downloading-using-tcastledownload-for-delphi/970/1 "2023-11-05T12:50:35Z")

</div>

| [![asynchronous_download with Delphi](https://forum.castle-engine.io/uploads/default/original/2X/1/107f3daf87a80554b0dda05a9517b5fcfeafaab2.png)](https://castle-engine.io/wp/wp-content/uploads/2023/11/Zrzut-ekranu-2023-11-05-014352.png "asynchronous\_download with Delphi") |
| [![remote_logging with Delphi](https://forum.castle-engine.io/uploads/default/original/2X/6/671dbf701d04ba6e7163e875e55fcfbc054304b6.png)](https://castle-engine.io/wp/wp-content/uploads/2023/11/Zrzut-ekranu-2023-11-05-015020.png "remote\_logging with Delphi") |

Our `TCastleDownload` component, that supports asynchronous downloading of resources, now rocks with Delphi too. It supports downloading from `http` and `https` (and other [URL protocols supported by Castle Game Engine](https://castle-engine.io/manual_network.php)).

You can test with Delphi e.g. these examples:

- [examples / network / asynchronous\_download](https://github.com/castle-engine/castle-engine/tree/master/examples/network/asynchronous_download)

- [examples / network / remote\_logging](https://github.com/castle-engine/castle-engine/tree/master/examples/network/remote_logging)

Most features you expect are supported:

- Asynchronous operation (`TCastleDownload` connecting and downloading doesn’t block the main thread),

- various HTTP methods (GET, POST with post data…),

- getting MIME type from server response,

- updating progress (total bytes, downloaded bytes),

- aborting download in the middle is instant and doesn’t cause any further problems.

- Both `http` and `https` work smoothly on Windows.

- The code also works on Delphi/Linux. Tested with not-yet-merged [delphi-linux branch](https://github.com/castle-engine/castle-engine/tree/delphi-linux).

The underlying implementation uses [Indy](https://www.indyproject.org/) (`TIdHttp` component). It is built-in in Delphi, so you don’t need to do anything. We have an alternative implementation using [TNetHttpClient](https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_an_HTTP_Client), though testing showed it has really bad speed, so we don’t recommend it. For more internal comments see the source code:

- [TCastleDownload Indy handler](https://github.com/castle-engine/castle-engine/blob/master/src/files/castledownload_url_http_indy.inc)

- [TCastleDownload TNetHttpClient handler](https://github.com/castle-engine/castle-engine/blob/master/src/files/castledownload_url_http_delphi_net.inc)

If you’re interested in http and https downloading using Delphi, without Castle Game Engine too, then you may be interested in my [test of TNetHttpClient and TIdHttp](https://github.com/michaliskambi/delphi-http-download).

### Share this:

- [Facebook](https://castle-engine.io/wp/2023/11/05/asynchronous-downloading-using-tcastledownload-for-delphi/?share=facebook "Click to share on Facebook")
- [Twitter](https://castle-engine.io/wp/2023/11/05/asynchronous-downloading-using-tcastledownload-for-delphi/?share=twitter "Click to share on Twitter")
- [LinkedIn](https://castle-engine.io/wp/2023/11/05/asynchronous-downloading-using-tcastledownload-for-delphi/?share=linkedin "Click to share on LinkedIn")
- [Reddit](https://castle-engine.io/wp/2023/11/05/asynchronous-downloading-using-tcastledownload-for-delphi/?share=reddit "Click to share on Reddit")
- Email
-
