0

UWP 流套接字

我想知道,当我 socket.EnableTransferOwnership 然后 On_Suspended 调用 socket.TransferOwnership(socketId); 我会失去发送数据的能力吗?

我正在编写一个流数据的 UWP 应用程序,我希望在后台我的 StreamSocket 仍然能够发送数据。

谢谢,雅各布

4

1 回答 1

0

当您的应用程序被暂停时,您将无法再发送数据。两种选择:

1)您在后台任务中处理数据发送(即使您的应用程序被暂停或终止也可以运行)
2)您创建一个扩展的执行会话(这将首先防止您的应用程序被暂停)

包含更多信息的链接:
后台任务概述: https ://docs.microsoft.com/en-us/windows/uwp/launch-resume/support-your-app-with-background-tasks

扩展执行概述: https ://docs.microsoft.com/en-us/windows/uwp/launch-resume/run-minimized-with-extended-execution

无限期在后台运行: https ://docs.microsoft.com/en-us/windows/uwp/launch-resume/run-in-the-background-indefinetly

于 2019-02-14T03:01:02.900 回答