Dela via


EndpointPair Class

Definition

Provides data for the local endpoint and remote endpoint for a network connection used by network apps.

public ref class EndpointPair sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Networking.IEndpointPairFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class EndpointPair final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Networking.IEndpointPairFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class EndpointPair final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Networking.IEndpointPairFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class EndpointPair
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Networking.IEndpointPairFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class EndpointPair
function EndpointPair(localHostName, localServiceName, remoteHostName, remoteServiceName)
Public NotInheritable Class EndpointPair
Inheritance
Object Platform::Object IInspectable EndpointPair
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

EndpointPair is used to initialize (and provide data for) an endpoint pair used in networking apps. The EndpointPair object provides data for the local and remote endpoints for a network connection. EndpointPair is also used by many classes in other related Windows Runtime namespaces for network apps; here are some examples of those.

An endpoint consists of these two elements.

  • The hostname, or IP address.
  • The service name, or the TCP or UDP port number.

And an endpoint pair consists of these two elements.

  • The local endpoint.
  • The remote endpoint.

If the local hostname is null for the local endpoint before a network connection is established by a client app, then the system will automatically provide the local IP address for the app to use.

If the local service name is an empty string for the local endpoint before a network connection is established by a client app, then the system will automatically provide a TCP or UDP port for the app to use.

The WiFiDirectDevice class can be used to locate other devices that have a Wi-Fi Direct (WFD) capable device. The WiFiDirectDevice.GetDeviceSelector method gets the device identifier for a nearby WFD device. Once you have a reference to a nearby WFD device, you can call the WiFiDirectDevice.GetConnectionEndpointPairs method to get an EndpointPair object.

Constructors

EndpointPair(HostName, String, HostName, String)

Creates a new EndpointPair object.

Properties

LocalHostName

Get or set the local hostname for the EndpointPair object.

LocalServiceName

Get or set the local service name for the EndpointPair object.

RemoteHostName

Get or set the remote hostname for the EndpointPair object.

RemoteServiceName

Get or set the remote service name for the EndpointPair object.

Applies to

See also