WiFiDirectServiceSession WiFiDirectServiceSession WiFiDirectServiceSession WiFiDirectServiceSession Class

Definition

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

public : sealed class WiFiDirectServiceSession : IWiFiDirectServiceSession, IClosablepublic sealed class WiFiDirectServiceSession : IWiFiDirectServiceSession, IDisposablePublic NotInheritable Class WiFiDirectServiceSession Implements IWiFiDirectServiceSession, IDisposable// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 AdvertisementId AdvertisementId AdvertisementId

Gets the advertisement ID for the session.

public : unsigned int AdvertisementId { get; }public uint AdvertisementId { get; }Public ReadOnly Property AdvertisementId As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

The advertisement ID.

ErrorStatus ErrorStatus ErrorStatus ErrorStatus

Gets the error status of the session.

public : WiFiDirectServiceSessionErrorStatus ErrorStatus { get; }public WiFiDirectServiceSessionErrorStatus ErrorStatus { get; }Public ReadOnly Property ErrorStatus As WiFiDirectServiceSessionErrorStatus// You can use this property in JavaScript.

ServiceAddress ServiceAddress ServiceAddress ServiceAddress

Gets the service address for this session.

public : PlatForm::String ServiceAddress { get; }public string ServiceAddress { get; }Public ReadOnly Property ServiceAddress As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The service address.

ServiceName ServiceName ServiceName ServiceName

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

public : PlatForm::String ServiceName { get; }public string ServiceName { get; }Public ReadOnly Property ServiceName As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The service name of the advertiser service.

SessionAddress SessionAddress SessionAddress SessionAddress

Gets the session address for the session.

public : PlatForm::String SessionAddress { get; }public string SessionAddress { get; }Public ReadOnly Property SessionAddress As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The session address.

SessionId SessionId SessionId SessionId

Gets the session ID.

public : unsigned int SessionId { get; }public uint SessionId { get; }Public ReadOnly Property SessionId As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

A unique session identifier.

Status Status Status Status

Gets the session status.

public : WiFiDirectServiceSessionStatus Status { get; }public WiFiDirectServiceSessionStatus Status { get; }Public ReadOnly Property Status As WiFiDirectServiceSessionStatus// You can use this property in JavaScript.

Methods

AddDatagramSocketAsync(DatagramSocket) AddDatagramSocketAsync(DatagramSocket) AddDatagramSocketAsync(DatagramSocket) 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.

public : IAsyncAction AddDatagramSocketAsync(DatagramSocket value)public IAsyncAction AddDatagramSocketAsync(DatagramSocket value)Public Function AddDatagramSocketAsync(value As DatagramSocket) As IAsyncAction// You can use this method in JavaScript.
Parameters
value
DatagramSocket DatagramSocket DatagramSocket DatagramSocket

The DatagramSocket instance to associate with this session.

Returns

An asynchronous association action. Returns on successful completion of the association.

AddStreamSocketListenerAsync(StreamSocketListener) AddStreamSocketListenerAsync(StreamSocketListener) AddStreamSocketListenerAsync(StreamSocketListener) 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.

public : IAsyncAction AddStreamSocketListenerAsync(StreamSocketListener value)public IAsyncAction AddStreamSocketListenerAsync(StreamSocketListener value)Public Function AddStreamSocketListenerAsync(value As StreamSocketListener) As IAsyncAction// You can use this method in JavaScript.
Parameters
value
StreamSocketListener StreamSocketListener StreamSocketListener StreamSocketListener

The StreamSocketListener instance to be associated with the session.

Returns

An asynchronous association action. Returns on successful completion of the association.

Close() Close() Close() Close()

Closes the session.

public : void Close()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.

Dispose() Dispose() Dispose() Dispose()

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

This member is not implemented in C++void Dispose()Sub Disposevoid Dispose()

GetConnectionEndpointPairs() GetConnectionEndpointPairs() GetConnectionEndpointPairs() GetConnectionEndpointPairs()

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

public : IVectorView<EndpointPair> GetConnectionEndpointPairs()public IReadOnlyList<EndpointPair> GetConnectionEndpointPairs()Public Function GetConnectionEndpointPairs() As IReadOnlyList( Of EndpointPair )// You can use this method in JavaScript.
Returns
IVectorView<EndpointPair> IReadOnlyList<EndpointPair> IReadOnlyList<EndpointPair> IReadOnlyList<EndpointPair>

An immutable snapshot list of endpoint pairs involved in the session.

Events

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

public : event TypedEventHandler RemotePortAdded<WiFiDirectServiceSession,  WiFiDirectServiceRemotePortAddedEventArgs>public event TypedEventHandler RemotePortAdded<WiFiDirectServiceSession,  WiFiDirectServiceRemotePortAddedEventArgs>Public Event RemotePortAdded<WiFiDirectServiceSession,  WiFiDirectServiceRemotePortAddedEventArgs>// You can use this event in JavaScript.

SessionStatusChanged SessionStatusChanged SessionStatusChanged SessionStatusChanged

Event raised when the session status changes.

public : event TypedEventHandler SessionStatusChanged<WiFiDirectServiceSession,  object>public event TypedEventHandler SessionStatusChanged<WiFiDirectServiceSession,  object>Public Event SessionStatusChanged<WiFiDirectServiceSession,  object>// You can use this event in JavaScript.