简体   繁体   English

UWP 应用中的命名管道

[英]Named Pipe in UWP App

I'm using a named pipe server in my UWP app, but I cannot get a python client running from the console to connect.我在 UWP 应用程序中使用命名管道服务器,但无法从控制台运行 python 客户端进行连接。 Where is the location of this pipe?这个管道的位置在哪里? And I think it has to do with UWP sandbox restrictions.我认为这与 UWP 沙箱限制有关。 Looked around a lot but seems microsoft is just getting to this stuff.环顾四周,但似乎微软刚刚开始接触这些东西。

# CS
new NamedPipeServerStream("LOCAL\MYPIPE");

# Python
f = open(r"\.\pipeLOCAL\MYPIPE", 'r+b', 0)

So while some MSFT resources may claim that UWP supports memory mapped files, it does not.因此,虽然某些 MSFT 资源可能声称 UWP 支持内存映射文件,但事实并非如此。

That is unless you are willing to use the desktop bridge, but given the complexities there, including the requirement you use 32bit!, you might as well bridge over TCP.除非您愿意使用桌面桥接,但考虑到那里的复杂性,包括您使用 32 位的要求!,您最好通过 TCP 进行桥接。

This may change with NET Core 3 in Q1?这可能会随着 Q1 中的 NET Core 3 而改变? 2019. 2019。

I hope if an MSFT employee reads this they can ask the right people why we can't have memory mapped files on side-loaded internal enterprise only apps.我希望如果 MSFT 员工读到这篇文章,他们可以问正确的人为什么我们不能在侧载内部企业应用程序上使用内存映射文件。 No doubt a major impediment to UWP uptake.毫无疑问,这是 UWP 应用的主要障碍。

I used AppServiceConnection我使用了AppServiceConnection

Covered by these tutorials (sorry for the link only answer but these tutorials are too long to paste here):这些教程涵盖了(抱歉只提供链接答案,但这些教程太长,无法粘贴在这里):

Create and consume an app service 创建和使用应用服务

Convert an app service to run in the same process as its host app 将应用服务转换为与其宿主应用在同一进程中运行

In my C# console application I also needed to reference these two libraries from here to make it work在我的 C# 控制台应用程序中,我还需要从这里引用这两个库以使其工作

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll

C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd

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

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