Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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


streamSocket.connectAsync(endpointPair).done( /* Your success and error handlers */ );

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.

In a Windows Store app, the StreamSocket class supports connecting to a remote endpoint when proxies are required to complete the connection. This support for proxies is automatic and transparent to the app. Connecting through proxies is not supported when a local host address is specified, so the LocalHostName property passed in the endpointPair parameter must be null. For more detailed information, see the remarks on Support for proxies in the StreamSocket class reference.

In a Windows Phone Store app, the StreamSocket class does not provide automatic support for proxies.

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 (HTML)
How to set timeouts on socket operations (XAML)
Reference
ConnectAsync(HostName, String)
ConnectAsync(EndpointPair, SocketProtectionLevel)
ConnectAsync(HostName, String, SocketProtectionLevel)
ConnectAsync(HostName, String, SocketProtectionLevel, NetworkAdapter)
EndpointPair
StreamSocket

 

 

Show:
© 2014 Microsoft