WiFiDirectServiceSession 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示 Wi-Fi Direct Services (WFDS) 會話。
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
- 繼承
- 屬性
- 實作
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
備註
您的程式碼不會直接具現化此類別。 建立新的會話或會話狀態變更時,實例會建立並傳遞至事件處理常式中的程式碼。
屬性
AdvertisementId |
取得會話的公告識別碼。 |
ErrorStatus |
取得會話的錯誤狀態。 |
ServiceAddress |
取得此會話的服務位址。 |
ServiceName |
取得涉及會話之廣告商服務的服務名稱。 |
SessionAddress |
取得會話的會話位址。 |
SessionId |
取得工作階段識別碼。 |
Status |
取得會話狀態。 |
方法
AddDatagramSocketAsync(DatagramSocket) |
將 DatagramSocket 新增至會話。 您的程式碼會在呼叫此方法之前建立 DatagramSocket。 將通訊端與會話建立關聯,會導致埠資訊傳送至遠端裝置, (會話中的) 。 (在此 API 方面,會話中的每個遠端裝置上都會引發 RemotePortAdded 事件,並指定 UDP 通訊協定.) 遠端裝置可以使用該資訊來開啟通訊端並聯機回本機電腦。 |
AddStreamSocketListenerAsync(StreamSocketListener) |
將 StreamSocketListener 新增至會話。 您的程式碼會在呼叫此方法之前建立 StreamSocketListener。 將通訊端與會話建立關聯,會導致埠資訊傳送至遠端裝置, (會話中的) 。 (在此 API 方面,會話中的每個遠端裝置上都會引發 RemotePortAdded 事件,並指定 TCP 通訊協定.) 遠端裝置可以使用該資訊來開啟通訊端並聯機回本機電腦。 |
Close() |
關閉會話。 |
Dispose() |
執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。 |
GetConnectionEndpointPairs() |
取得會話的連接端點組清單。 您的程式碼會使用 IVectorView 作業來列舉清單中的端點組。 |
事件
RemotePortAdded |
將新的遠端埠新增至會話時引發的事件。 事件處理常式應該藉由建立與新遠端埠的適當通訊端連線來回應。 |
SessionStatusChanged |
會話狀態變更時引發的事件。 |