简体   繁体   English

UWP应用程序拒绝在P2P服务器部分中接收数据

[英]UWP application refuses to receive data in P2P server part

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). 我正在尝试使用C语言编写的网络库来创建用C ++语言编写的P2P(UDP)Windows 10 UWP应用程序(尝试enet和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). 问题是,当应用程序像客户端一样运行时,一切都按预期工作,但是当我测试服务器部分时,应用程序拒绝接收任何事件(enet中的连接和来自libuv的消息)。 I tried the code from simple console applications and it works for both enet and libuv! 我从简单的控制台应用程序中尝试了该代码,它适用于enet和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? 我的问题是,我是否需要对UWP应用程序进行其他配置才能接收?

According to your description on your same thread in MSDN, the server and the client are on the same device. 根据您对MSDN中同一线程的描述,服务器和客户端位于同一设备上。 According to the note of DatagramSocket official sample : 根据DatagramSocket 官方示例的注释:

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. 使用IP回送地址的网络通信通常不能用于通用Windows平台(UWP)应用程序与其他进程(不同的UWP应用程序或桌面应用程序)之间的进程间通信,因为这受到网络隔离的限制。

We cannot communicate a uwp app with other apps in a same machine. 我们无法将uwp应用与同一台计算机上的其他应用进行通信。 Not even with a loopback exemption. 甚至没有环回豁免。 This is as design. 这是设计。 If you use ac# console project as server and a uwp app as client, they may communicate successfully. 如果将ac#控制台项目用作服务器,将uwp应用程序用作客户端,则它们可能会成功通信。 But it need special steps (Eg run the console as administrator) to let it work which you may happen to meet the requirements. 但是它需要特殊的步骤(例如,以管理员身份运行控制台)以使其正常运行,而您可能恰巧满足了要求。 Details you can reference this thread . 您可以参考此线程的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM