Share via


WiFiDirectServiceSession Class

Definition

Represents a Wi-Fi Direct Services (WFDS) session.

public ref class WiFiDirectServiceSession sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class WiFiDirectServiceSession final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class WiFiDirectServiceSession : System.IDisposable
Public NotInheritable Class WiFiDirectServiceSession
Implements IDisposable
Inheritance
Object Platform::Object IInspectable WiFiDirectServiceSession
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Your code does not instantiate this class directly. An instance is created and passed to your code in event handlers when a new session is created or session state changes.

Properties

AdvertisementId

Gets the advertisement ID for the session.

ErrorStatus

Gets the error status of the session.

ServiceAddress

Gets the service address for this session.

ServiceName

Gets the service name of the advertiser service involved in the session.

SessionAddress

Gets the session address for the session.

SessionId

Gets the session ID.

Status

Gets the session status.

Methods

AddDatagramSocketAsync(DatagramSocket)

Adds a DatagramSocket to the session. Your code creates the DatagramSocket before calling this method. Associating a socket to the session causes port information to be sent to the remote device(s) in the session. (In terms of this API, a RemotePortAdded event is raised on each remote device in the session, specifying the UDP protocol.) A remote device can use that information to open a socket and connect back to the local machine.

AddStreamSocketListenerAsync(StreamSocketListener)

Adds a StreamSocketListener to the session. Your code creates the StreamSocketListener before calling this method. Associating a socket to the session causes port information to be sent to the remote device(s) in the session. (In terms of this API, a RemotePortAdded event is raised on each remote device in the session, specifying the TCP protocol.) A remote device can use that information to open a socket and connect back to the local machine.

Close()

Closes the session.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetConnectionEndpointPairs()

Gets a list of connection endpoint pairs for the session. Your code uses IVectorView operations to enumerate the endpoint pairs in the list.

Events

RemotePortAdded

Event raised when a new remote port is added to the session. Your event handler should respond by establishing the appropriate socket connection to the new remote port.

SessionStatusChanged

Event raised when the session status changes.

Applies to

See also