Connect to other machine through WiFi Direct using Windows built-in app
I have a question about connecting any device to Windows using WiFi Direct. In my case, the device is a Linux based device, but it shouldn't matter. I am using the built-in application in Windows, accessible from Settings -> Bluetooth & devices -> Add device -> Everything else.
What I managed to achieve is that from this application, I successfully find my device. When I click on it, it starts connecting. The WiFi Direct connection is successful, the P2P group is negotiated, and I also get an IP from Windows. The IP connection works, I confirmed it with a ping. Unfortunately, after a while (1 minute), Windows sends a "Disconnected" message and the network disconnects.
I also used a sample C# application for WiFi Direct communication: https://learn.microsoft.com/en-us/samples/microsoft/windows-universal-samples/wifidirect/. In this case, I also managed to connect, and this time everything worked as expected, no sudden disconnection.
Why did the method from "Settings -> Add device" not work fully, and why did Windows disconnect the network? Is there anything that needs to be provided to maintain the connection?
A dedicated application for connecting is a solution, but I would prefer not to need an additional application. Ideally, the built-in one in Windows should be sufficient.