Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 2.88 KB

streamsocket_connectasync_13692504.md

File metadata and controls

35 lines (24 loc) · 2.88 KB
-api-id -api-type
M:Windows.Networking.Sockets.StreamSocket.ConnectAsync(Windows.Networking.EndpointPair)
winrt method

Windows.Networking.Sockets.StreamSocket.ConnectAsync

-description

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

-parameters

-param 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.

-returns

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 UWP 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 8.x app, the StreamSocket class does not provide automatic support for proxies.

-examples

-see-also

How to set timeouts on socket operations , How to set timeouts on socket operations , ConnectAsync(HostName, String), ConnectAsync(EndpointPair, SocketProtectionLevel), ConnectAsync(HostName, String, SocketProtectionLevel), ConnectAsync(HostName, String, SocketProtectionLevel, NetworkAdapter), EndpointPair

-capabilities

internetClientServer, privateNetworkClientServer, ID_CAP_NETWORKING [Windows Phone]