System.Net.URLClient.TURLClient.DoExecuteAsync
Delphi
function DoExecuteAsync(const AsyncCallback: TAsyncCallback; const AsyncCallbackEvent: TAsyncCallbackEvent; const ARequestMethod: string; const AURI: TURI;
const ASourceStream, AContentStream: TStream; const AHeaders: TNetHeaders; AOwnsSourceStream: Boolean = False): IAsyncResult; virtual;
C++
virtual System::Types::_di_IAsyncResult __fastcall DoExecuteAsync(const System::Classes::_di_TAsyncCallback AsyncCallback, const System::Classes::TAsyncCallbackEvent AsyncCallbackEvent, const System::UnicodeString ARequestMethod, const TURI &AURI, System::Classes::TStream* const ASourceStream, System::Classes::TStream* const AContentStream, const TNetHeaders AHeaders, bool AOwnsSourceStream = false);
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| function | protected | System.Net.URLClient.pas System.Net.URLClient.hpp |
System.Net.URLClient | TURLClient |
Description
- Note: Subclasses of TURLClient must provide their own implementation of DoExecuteAsync, which should work as described below. When you call TURLClient.DoExecuteAsync, it raises an ENetURIClientException exception.
Starts an asynchronous URL request.
When you call DoExecuteAsync, you must provide the data required to perform your URL request:
AsyncCallbackis a callback procedure to be called when a response is received or the request fails.AsyncCallbackEventis an event handler to be called when a response is received or the request fails ifAsyncCallbackis nil.ARequestMethodis a string that defines the request method to use. Possible request methods depend on the protocol.AURIis a URI that identifies the location of the resource that you request.ASourceStreamis a stream of data to provide in the request.AContentStreamis a stream to hold the data included in the response.AHeadersis a list of headers to include in the request.AOwnsSourceStreamdetermines whetherASourceStreamshould be freed when the request is submitted (True) or not (False).
DoExecuteAsync returns an asynchronous result object that starts being filled with the response data asynchronously.
When all the response data is received into the response object, the callback function or event handler is called, and provides the corresponding response object as a parameter.
Call EndAsyncURL with the target asynchronous result object as a parameter to ensure that the operation succeeded; EndAsyncURL raises an exception if there was any issue during the request, such as a timeout.
You usually call EndAsyncURL inside the callback function or event handler, where you know that the response data has been received already. However, you can actually call EndAsyncURL at any moment, which stops the program execution until the response data is received, effectively turning the asynchronous request into a synchronous request.
BeginExecute calls DoExecuteAsync.