UWP application refuses to receive data in P2P server part

202 views Asked by At

I am trying to create P2P(UDP) windows 10 UWP application written in c++ using networking library written in C (tried both enet and libuv). The problem is when the app is acting like client everything works as expected, but when I am testing the server part the application refuse to receive any events (connection in enet and messages from libuv). I tried the code from simple console applications and it works for both enet and libuv! Also I added rules in the firewall to allow everything on the default port.

My question is, do I need to make additional configurations for the UWP application for receiving?

1

There are 1 answers

1
Sunteen Wu On BEST ANSWER

According to your description on your same thread in MSDN, the server and the client are on the same device. According to the note of DatagramSocket official sample:

Network communications using an IP loopback address cannot normally be used for interprocess communication between a Universal Windows Platform (UWP) app and a different process (a different UWP app or a desktop app) because this is restricted by network isolation.

We cannot communicate a uwp app with other apps in a same machine. Not even with a loopback exemption. This is as design. If you use a c# console project as server and a uwp app as client, they may communicate successfully. But it need special steps (E.g. run the console as administrator) to let it work which you may happen to meet the requirements. Details you can reference this thread.