I need to pass data from one process to another. In the "Visual C++ Version 6" world I would have used a global named pipe for this task. I'm developing in C# and would like to know what construct there is for either creating named pipes or for a "new" technique to pass data from one process to the other.
One other specific is that the process producing the information, i.e., filling the pipe, is a service created using C#. The service, when it receives a command needs to reply with a small amount of data to the process that sent the command to the service. I was planning to do this via a pipe. The service would create the global named pipe while the "client" would access the global named pipe using CreateFile.
- Neil Shore

Named Pipes in C#
jameswilson
jfuentes
Andreas,< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your reply. I took a quick look at the article, but I'll need some time to review it. It figures "The Code Project" would have something about it. It may be overkill for what I need but it looks like a great starting place. I just thought that I was missing some documentation that would point me to a .net class or namespace to simplify coding pipes. I guess it is not so.
Thanks again.
- Neil
pepellini
Alan,< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your reply. I have written code for named pipes using Visual C/C++ Version 6. So, I am familiar with the API and the code required. I hoped that the .net development environment had a class or namespace, or something that I missed in the documentation, to make the coding easier.
I would be interested in seeing your approach once you have it working.
Thanks again.
- Neil
stibitz
Andreas,
Thanks, I've downloaded the project and played with it. I will probably use it in a stripped down version.
- Neil
Jon Davis
OmegaMan,
No, LOL, I haven't been waiting all this time. My solution was to write a DLL in C++, which uses the Windows API, and then use a wrapper for the DLL in the C# application. It's running and installed in a number of locations.
However, thanks for the WCF .Net 3 solution. It will be a while before I can work in the WCF and .Net 3 world. I will still take a look at your blog and download the code.
Thanks for the post.
ShoreNuff
bobmccle
Hi,
I am failry new to C# but I have needed to write a multi-threaded messaging service using named pipes. You have to call native windows API functions to implement named pipes in the dot net environment. If you are interested I will send you the code when I have it running correctly.
Alan Seedhouse
jagadishk_msft
There is a complete sample provided to send strings to a server and get it returned. I even tested it in C# Express.
If you can not download the zip from codeproject you can get it at the authors website.
I am also looking to do some communication between .NET applications and it seems to be few alternatives to remoting. This could be an interesting alternative.
Fingerlickin
This article might be helpful
http://www.codeproject.com/csharp/DotNetNamedPipesPart1.asp
Robert Jeppesen
The example that is provided cannot be used with a multi-threaded client because the Read blocks the Write call too (on the client-side)
This is a simple implementation here ..
http://i-d-e-a-s.blogspot.com/2006/04/net-and-named-pipes.html
basically you use CreatFile to create a client pipe and pass the handle to the System.IO.FileStream and then you can use BeginRead and BeginWrite for Async IO.
--Yatharth