4

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. The windows application cannot be changed. Does anyone know if there is a Linux library available that supports Windows named pipes? Or even better, can anyone recommend a library they have used for this purpose?

Steve Townsend
  • 53,498
  • 9
  • 91
  • 140
MichaelB76
  • 640
  • 1
  • 6
  • 15
  • A pipe is local communication system, it does not expand to networks... so how should a Linux system get access to a pipe on a Windows system, which by definition must be a different system (even a VM) ? Or do you want to know how to write a proxy or something like that ? – DarkDust Oct 18 '10 at 14:38
  • 4
    @DarkDust: Windows named pipes are exported over the network name space. You can open one from another Windows machine with the correct security attributes and prepending the pipe name with the WINS name. – Amardeep AC9MF Oct 18 '10 at 14:40
  • Windows named pipes work differently from the standard Linux ones, and do work across a network. I'm asking if anyone has written a library in Linux to support Windows named pipes. – MichaelB76 Oct 18 '10 at 14:45
  • In the end I wrote a Windows proxy service which bridged between a Windows pipe and a socket. – MichaelB76 Apr 30 '14 at 16:14

2 Answers2

13

Windows and Linux named pipes are different animals. 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. 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.

If I was doing this I would try to produce a simple passthrough proxy in C# (managed code) as a proof of concept. Can always convert to native code (Win32/C++) if throughput does not measure up. There is some sample C# code here that might be a useful reference.

Here is background on the nuances of Windows vs Linux named pipes.

Community
  • 1
  • 1
Steve Townsend
  • 53,498
  • 9
  • 91
  • 140
  • Thanks. the idea of writing a proxy on the Windows side had occurred to me, but I'm metting resistance on the idea of installing anything on the Windows server... – MichaelB76 Oct 18 '10 at 14:55
  • 1
    @MichaelB76 - how frustrating ... hopefully a well-argued presentation of risks and costs in trying to do NP interop can swing the argument for you. What is the Windows OS? One machine, or many? – Steve Townsend Oct 18 '10 at 14:58
4

I bet Samba/Winbind contains highly relevant code. Not sure how reusable it is, though.

nobody
  • 19,814
  • 17
  • 56
  • 77
  • 1
    I think the Samba suite contains something useful; not sure how to use it though. Some of the samba tools must internally connect to NT named pipes. – MarkR Oct 18 '10 at 20:56
  • 1
    Correct. The key here is the `IPC$` share. The "files" in this share are really named pipes which connect to the file server process. – MSalters Aug 13 '18 at 09:12