System.Net.Socket.TSocket.BeginConnect
Delphi
function BeginConnect(const AsyncCallbackEvent: TAsyncCallbackEvent; const Name, Address, Service: string; Port: Word): IAsyncResult; overload;
function BeginConnect(const AsyncCallbackEvent: TAsyncCallbackEvent; const Endpoint: TNetEndpoint): IAsyncResult; overload;
function BeginConnect(const AsyncCallback: TAsyncCallback; const Name, Address, Service: string; Port: Word): IAsyncResult; overload;
function BeginConnect(const AsyncCallback: TAsyncCallback; const Endpoint: TNetEndpoint): IAsyncResult; overload;
function BeginConnect(const Name, Address, Service: string; Port: Word): IAsyncResult; overload; inline;
function BeginConnect(const Endpoint: TNetEndpoint): IAsyncResult; overload; inline;
C++
System::Types::_di_IAsyncResult __fastcall BeginConnect(const System::Classes::TAsyncProcedureEvent AsyncCallbackEvent, const System::UnicodeString Name, const System::UnicodeString Address, const System::UnicodeString Service, System::Word Port)/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginConnect(const System::Classes::TAsyncProcedureEvent AsyncCallbackEvent, const TNetEndpoint &Endpoint)/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginConnect(const System::Classes::_di_TAsyncCallback AsyncCallback, const System::UnicodeString Name, const System::UnicodeString Address, const System::UnicodeString Service, System::Word Port)/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginConnect(const System::Classes::_di_TAsyncCallback AsyncCallback, const TNetEndpoint &Endpoint)/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginConnect(const System::UnicodeString Name, const System::UnicodeString Address, const System::UnicodeString Service, System::Word Port)/* overload */;
System::Types::_di_IAsyncResult __fastcall BeginConnect(const TNetEndpoint &Endpoint)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Net.Socket.pas System.Net.Socket.hpp |
System.Net.Socket | TSocket |
Description
Establishes a connection to the specified endpoint asynchronously.
In order to establish a direct connection, the type of your socket must be any of the following:
UDP
RAW
RDM
SEQ
Calls to BeginConnect return immediately and return an instance of a class that implements the IAsyncResult interface.
You may pass BeginConnect the following parameters:
AsyncCallbackEvent
, an event handler of type TAsyncCallbackEvent that is called once a connection is established.AsyncCallback
, a method of type TAsyncCallback that is called once a connection is established.
To specify the target endpoint, you must provide either of the following combinations of parameters:
- An endpoint (
Endpoint
). - An IP address (
Address
) and a service (Service
). You may pass an empty word asPort
, asService
is used to determine the port. - An IP address (
Address
) and a port (Port
). Pass an empty string asService
, otherwise the specified service name is used to determine the port to use, and the specified port is ignored.
Once your callback event handler or method is called, pass EndConnect the returned instance of a class that implements the IAsyncResult interface, in order to establish a connection to the previously specified endpoint.