简体   繁体   English

Linux中的Windows命名管道支持

[英]Windows Named Pipe Support in Linux

I'm looking at a project which will require inter-process communication between a legacy Windows application using named pipes, and a new service running on a Linux server. 我正在研究一个项目,该项目需要使用命名管道的传统Windows应用程序与在Linux服务器上运行的新服务之间进行进程间通信。 The windows application cannot be changed. Windows应用程序无法更改。 Does anyone know if there is a Linux library available that supports Windows named pipes? 有谁知道是否有可用的Linux库支持Windows命名管道? Or even better, can anyone recommend a library they have used for this purpose? 或者甚至更好,有人可以推荐他们用于此目的的图书馆吗?

Windows and Linux named pipes are different animals. Windows和Linux命名管道是不同的动物。 If an interop solution exists you are going to be one of a very small population of users. 如果存在互操作解决方案,那么您将成为极少数用户之一。

You might be better off writing a proxy on the Windows side to map between Named Pipe and socket, and connecting this to a socket on the Linux end. 您可能最好在Windows端编写代理以在命名管道和套接字之间进行映射,并将其连接到Linux端的套接字。 This provides you a useful networked interface on the Linux side going forward, and removes what might be a world of Named Pipes interop hurt from the picture. 这为您提供了一个有用的Linux网络接口,并从图片中删除了可能是命名管道互操作的世界。

If I was doing this I would try to produce a simple passthrough proxy in C# (managed code) as a proof of concept. 如果我这样做,我会尝试在C#(托管代码)中生成一个简单的passthrough代理作为概念证明。 Can always convert to native code (Win32/C++) if throughput does not measure up. 如果吞吐量没有达到,则可以始终转换为本机代码(Win32 / C ++)。 There is some sample C# code here that might be a useful reference. 有一些C#示例代码在这里 ,可能是一个有用的参考。

Here is background on the nuances of Windows vs Linux named pipes . 以下是Windows与Linux命名管道的细微差别的背景知识

I bet Samba/Winbind contains highly relevant code. 我敢打赌Samba / Winbind包含高度相关的代码。 Not sure how reusable it is, though. 但不确定它是如何重复使用的。

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

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