Dela via


StreamSocket.GetEndpointPairsAsync Method

Definition

Overloads

GetEndpointPairsAsync(HostName, String)

Gets a list of EndpointPair objects based on a remote hostname and remote service name that can be used to send TCP packets to a remote network destination.

GetEndpointPairsAsync(HostName, String, HostNameSortOptions)

Gets a list of EndpointPair objects based on a remote hostname and remote service name and the sort order to be used.

GetEndpointPairsAsync(HostName, String)

Gets a list of EndpointPair objects based on a remote hostname and remote service name that can be used to send TCP packets to a remote network destination.

public:
 static IAsyncOperation<IVectorView<EndpointPair ^> ^> ^ GetEndpointPairsAsync(HostName ^ remoteHostName, Platform::String ^ remoteServiceName);
/// [Windows.Foundation.Metadata.Overload("GetEndpointPairsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IVectorView<EndpointPair>> GetEndpointPairsAsync(HostName const& remoteHostName, winrt::hstring const& remoteServiceName);
[Windows.Foundation.Metadata.Overload("GetEndpointPairsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IReadOnlyList<EndpointPair>> GetEndpointPairsAsync(HostName remoteHostName, string remoteServiceName);
function getEndpointPairsAsync(remoteHostName, remoteServiceName)
Public Shared Function GetEndpointPairsAsync (remoteHostName As HostName, remoteServiceName As String) As IAsyncOperation(Of IReadOnlyList(Of EndpointPair))

Parameters

remoteHostName
HostName

The hostname of a service. The service might actually be hosted on multiple services, so that a DNS lookup returns multiple IP addresses for the various servers. This method returns one endpoint pair for each of the servers found by a DNS lookup.

remoteServiceName
String

Platform::String

winrt::hstring

The name or port number of a remote service. Note that different servers might support the named service on different physical ports, so not all of the returned endpoints will use the same service port number.

Returns

An asynchronous lookup operation. On successful completion, the returned list contains one EndpointPair for each remote host found, with one end point being one of the remote hosts and the other being the local host.

Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

This method gets a list of possible EndpointPair objects that can be used by a StreamSocket to send data to a remote network destination using TCP. The returned list is sorted so that the address pairs that are best suited for communication between two peers occur earlier in the list.

A StreamSocket can use the list returned by this method to try and bind or connect to each EndpointPair object until a connection can be made. An EndpointPair object from the list would be used with the ConnectAsync(EndpointPair) methods

See also

Applies to

GetEndpointPairsAsync(HostName, String, HostNameSortOptions)

Gets a list of EndpointPair objects based on a remote hostname and remote service name and the sort order to be used.

public:
 static IAsyncOperation<IVectorView<EndpointPair ^> ^> ^ GetEndpointPairsAsync(HostName ^ remoteHostName, Platform::String ^ remoteServiceName, HostNameSortOptions sortOptions);
/// [Windows.Foundation.Metadata.Overload("GetEndpointPairsWithSortOptionsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IVectorView<EndpointPair>> GetEndpointPairsAsync(HostName const& remoteHostName, winrt::hstring const& remoteServiceName, HostNameSortOptions const& sortOptions);
[Windows.Foundation.Metadata.Overload("GetEndpointPairsWithSortOptionsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IReadOnlyList<EndpointPair>> GetEndpointPairsAsync(HostName remoteHostName, string remoteServiceName, HostNameSortOptions sortOptions);
function getEndpointPairsAsync(remoteHostName, remoteServiceName, sortOptions)
Public Shared Function GetEndpointPairsAsync (remoteHostName As HostName, remoteServiceName As String, sortOptions As HostNameSortOptions) As IAsyncOperation(Of IReadOnlyList(Of EndpointPair))

Parameters

remoteHostName
HostName

The remote hostname or IP address.

remoteServiceName
String

Platform::String

winrt::hstring

The remote service name or UDP port.

sortOptions
HostNameSortOptions

The sort order to use when returning the list.

Returns

A list of EndpointPair objects.

Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

The GetEndpointPairsAsync method gets a list of possible EndpointPair objects that can be used by a StreamSocket to connect to a remote network destination. The returned list is sorted based on the sortOptions parameter.

A StreamSocket can use the list returned by this method to try and bind or connect to each EndpointPair object until a remote destination can be reached. An EndpointPair object from the list would be used with the ConnectAsync(EndpointPair) method.

See also

Applies to