This topic has not yet been rated - Rate this topic

StreamSocket.ConnectAsync(EndpointPair) | connectAsync(EndpointPair) method

Applies to Windows and Windows Phone

Starts an asynchronous operation on a StreamSocket object to connect to a remote network destination specified as an EndpointPair object.

Syntax


public:
IAsyncAction^ ConnectAsync(
  EndpointPair^ endpointPair
)

Parameters

endpointPair

Type: EndpointPair

An EndpointPair object that specifies the local hostname or IP address, the local service name or TCP port, the remote hostname or remote IP address, and the remote service name or remote TCP port for the remote network destination.

Return value

Type: IAsyncAction

An asynchronous connect operation on a StreamSocket object.

Remarks

If the EndpointPair object passed in the endpointPair parameter contains null for the LocalHostName property, then the system will supply the local IP address that will be used. If the EndpointPair object passed in the endpointPair parameter contains an empty string for the LocalServiceName property, then the system will supply the local TCP port that will be used.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Networking.Sockets
Windows::Networking::Sockets [C++]

Metadata

Windows.winmd

DLL

Windows.Networking.dll

Capabilities

internetClientServer
privateNetworkClientServer
ID_CAP_NETWORKING [Windows Phone]

See also

Other resources
How to set timeouts on socket operations (Windows Store apps using JavaScript and HTML)
How to set timeouts on socket operations (Windows Store apps using C#/VB/C++ and XAML)
Reference
ConnectAsync(HostName, String)
ConnectAsync(EndpointPair, SocketProtectionLevel)
ConnectAsync(HostName, String, SocketProtectionLevel)
ConnectAsync(HostName, String, SocketProtectionLevel, NetworkAdapter)
EndpointPair
StreamSocket

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.