System.Net.URLClient.TURLClient.BeginExecute

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function BeginExecute(const ARequestMethod: string; const AURI: TURI; const ASourceStream: TStream = nil;
const AContentStream: TStream = nil; const AHeaders: TNetHeaders = nil): IAsyncResult; overload;
function BeginExecute(const AsyncCallbackEvent: TAsyncCallbackEvent; const ARequestMethod: string; const AURI: TURI; const ASourceStream: TStream = nil;
const AContentStream: TStream = nil; const AHeaders: TNetHeaders = nil): IAsyncResult; overload;
function BeginExecute(const AsyncCallback: TAsyncCallback; const ARequestMethod: string; const AURI: TURI; const ASourceStream: TStream = nil;
const AContentStream: TStream = nil; const AHeaders: TNetHeaders = nil): IAsyncResult; overload;
function BeginExecute(const ARequestMethod: string; const AURIStr: string; const ASourceStream: TStream = nil;
const AContentStream: TStream = nil; const AHeaders: TNetHeaders = nil): IAsyncResult; overload;
function BeginExecute(const AsyncCallbackEvent: TAsyncCallbackEvent; const ARequestMethod: string; const AURIStr: string; const ASourceStream: TStream = nil;
const AContentStream: TStream = nil; const AHeaders: TNetHeaders = nil): IAsyncResult; overload;
function BeginExecute(const AsyncCallback: TAsyncCallback; const ARequestMethod: string; const AURIStr: string; const ASourceStream: TStream = nil;
const AContentStream: TStream = nil; const AHeaders: TNetHeaders = nil): IAsyncResult; overload;

C++

System::Types::_di_IAsyncResult __fastcall BeginExecute(const System::UnicodeString ARequestMethod, const TURI &AURI, System::Classes::TStream* const ASourceStream = (System::Classes::TStream*)(0x0), System::Classes::TStream* const AContentStream = (System::Classes::TStream*)(0x0), const TNetHeaders AHeaders = System::DynamicArray<TNameValuePair>())/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginExecute(const System::Classes::TAsyncCallbackEvent AsyncCallbackEvent, const System::UnicodeString ARequestMethod, const TURI &AURI, System::Classes::TStream* const ASourceStream = (System::Classes::TStream*)(0x0), System::Classes::TStream* const AContentStream = (System::Classes::TStream*)(0x0), const TNetHeaders AHeaders = System::DynamicArray<TNameValuePair>())/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginExecute(const System::Classes::_di_TAsyncCallback AsyncCallback, const System::UnicodeString ARequestMethod, const TURI &AURI, System::Classes::TStream* const ASourceStream = (System::Classes::TStream*)(0x0), System::Classes::TStream* const AContentStream = (System::Classes::TStream*)(0x0), const TNetHeaders AHeaders = System::DynamicArray<TNameValuePair>())/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginExecute(const System::UnicodeString ARequestMethod, const System::UnicodeString AURIStr, System::Classes::TStream* const ASourceStream = (System::Classes::TStream*)(0x0), System::Classes::TStream* const AContentStream = (System::Classes::TStream*)(0x0), const TNetHeaders AHeaders = System::DynamicArray<TNameValuePair>())/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginExecute(const System::Classes::TAsyncCallbackEvent AsyncCallbackEvent, const System::UnicodeString ARequestMethod, const System::UnicodeString AURIStr, System::Classes::TStream* const ASourceStream = (System::Classes::TStream*)(0x0), System::Classes::TStream* const AContentStream = (System::Classes::TStream*)(0x0), const TNetHeaders AHeaders = System::DynamicArray<TNameValuePair>())/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginExecute(const System::Classes::_di_TAsyncCallback AsyncCallback, const System::UnicodeString ARequestMethod, const System::UnicodeString AURIStr, System::Classes::TStream* const ASourceStream = (System::Classes::TStream*)(0x0), System::Classes::TStream* const AContentStream = (System::Classes::TStream*)(0x0), const TNetHeaders AHeaders = System::DynamicArray<TNameValuePair>())/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.Net.URLClient.pas
System.Net.URLClient.hpp
System.Net.URLClient TURLClient

Description

Starts an asynchronous URL request.

When you call BeginExecute, you must provide the data required to perform your URL request:

  • ARequestMethod is a string that defines the request method to use. Possible request methods depend on the protocol.
  • AURI (TURI) or AURIStr (string) is a URI that identifies the location of the resource that you request.
  • ASourceStream (optional) is a stream of data to provide in the request.
  • AContentStream (optional) is a stream to hold the data included in the response.
  • AHeaders (optional) is a list of headers to include in the request.
  • AsyncCallback (optional) is a callback procedure to be called when a response is received or the request fails.
  • AsyncCallbackEvent (optional) is an event handler to be called when a response is received or the request fails if AsyncCallback is nil.

BeginExecute returns a response 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 response 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.

See Also