Using StreamSocketListener in the background with SocketActivityTrigger

拈花ヽ惹草 提交于 2020-01-16 09:57:14

问题


In order to make a UWP App act like an HTTP server, restup does the job. But the problem is that it does not provide an HTTP server that works even after the app is closed.

In order to achieve this, a background task with SocketActivityTrigger has to be created and the socket ownership of StreamSocketListener has to be transferred to the socket broker so that the background task is triggered when a request comes (as explained here). And here is an example for an app that connects to a socket and keeps receiving messages even after the app is closed.

I tried to adapt this to make restup work in the background as well, but in vain!

Could someone help on this please?

来源:https://stackoverflow.com/questions/59716347/using-streamsocketlistener-in-the-background-with-socketactivitytrigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!