-api-id | -api-type |
---|---|
M:Windows.Networking.Sockets.StreamSocket.ConnectAsync(Windows.Networking.EndpointPair) |
winrt method |
Starts an asynchronous operation on a StreamSocket object to connect to a remote network destination specified as an EndpointPair object.
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.
An asynchronous connect operation on a StreamSocket object.
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.
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
internetClientServer, privateNetworkClientServer, ID_CAP_NETWORKING [Windows Phone]