Using localhost 127.0.0.1 sockets to communicate works when you debug, but when you go to install your UWP app its blocked!
UDP sockets
UDP isn’t permitted from UWP app to UWP app (stated here – “The UDP protocol is not supported”.)
In our testing, UDP client is possible, if you use the telerik AppContainer Loopback Utility to enable loopback usage for the UWP app (we found “CheckNetIsolation LoopbackExempt” commands didn’t work (resulted in app not found when listing exemptions for us), but this telerik app worked great). After a reboot it will then connect successfully.
Note that when debugging with Visual Studio you’ll find that UDP client works fine because Visual Studio enables the loopback usage. Its once the UWP app is installed you discover the loopback address can’t be used and the the telerik AppContainer Loopback Utility is needed.
However, implementing a UDP server on 127.0.0.1 in our UWP app didn’t work for us under any circumstances – our Win32 apps packets did not reach its port when sent to 127.0.0.1.
TCP Sockets
TCP connectivity to 127.0.0.1 is possible if your app is sideloaded (not installed via the app store), we’ve done this to implement comms between a UWP app and a Win32 app, with the Win32 app acting as TCP server (listening for a connection). You still need to use the telerik AppContainer Loopback Utility (or equivalent) to enable loopback usage for the UWP app once it’s been installed. After a reboot, it will then connect successfully.
Here are some further resources :
https://learn.microsoft.com/en-us/windows/uwp/communication/interprocess-communication