0

Scenario. I want to make UWP(8.1/10) library (somekind of remote diagnostic of app) which works with my server. Is it possible to keep tcp/ip connection in background as long as possible?

I know about two things:

But if I want to insert my library into some app and then upload it in Store, it won't work, am I right?

However, developers writing UWP apps for personal use (that is, side loaded apps that won't be published in the Microsoft Store), or developers writing Enterprise UWP apps, may want to use all resources available on the device without any background or extended execution throttling. Line of business and personal UWP applications can use APIs in the Windows Creators Update (version 1703) to turn off throttling. Be aware that you can't put an app into the Microsoft Store if it uses these APIs.

Also I have read about ExtendedExecutionSession when app minimized from these questions:

But I'm still confused. So, can I make library for UWP(8.1/10) with long-running background tcp/ip connection and insert into app which will be uploaded in Windows Store?

hi.cosmonaut
  • 120
  • 1
  • 9
  • Just create a class that uses asynchronous TCP. Not sure why you need UWP. See msdn example which uses sockets. You can replace the sockets with any class that inherits the socket like TcpClient and TcpListener : https://learn.microsoft.com/en-us/dotnet/framework/network-programming/socket-code-examples – jdweng Jul 29 '18 at 09:03
  • Thank you but I don't have any problems with TCP, my problem is future insertion of my long-running background work with TCP in app which will be uploaded in Windows Store – hi.cosmonaut Jul 29 '18 at 09:33
  • TCP runs forever until the connection it terminated. Asynchronous reads/writes will run in background without affecting the application. So I do not understand the issue. I not sure why you need a background task. The processing should be triggered by getting reads/writes from the asynchronous reads/writes. – jdweng Jul 29 '18 at 09:55
  • Do you know will it work in UWP apps? Because I need it to work on desktops/tablets/laptops/phones not only PC. One library have to work on all platforms. – hi.cosmonaut Jul 29 '18 at 10:12
  • Why won't a straight class work? Classes are not restricted to any type project. Classes work in all projects. – jdweng Jul 29 '18 at 10:52
  • Because tcp connection starts from background not from UI, I send push notification from my server, app receives and connection (remote diagnostics) starts – hi.cosmonaut Jul 29 '18 at 11:10
  • Why does a class need to execute from background? Just call the class constructor, start the asynchronous Client/Listener and return. The class will run forever. – jdweng Jul 29 '18 at 12:22

0 Answers0