Here is a little helper that I wrote.
To use it:
var pipeListener = new NamedPipeListener<String>(); // instantiate an instance pipeListener.MessageReceived += (sender, e) => MessageBox.Show(e.Message);
From another process:
NamedPipeListener<String>.SendMessage("Howdy howdy howdy");
Note that it uses the full name PipeListener as the default name for the channel. If you need to be more careful, use a constructor overload that takes the name of the pipe.
Here's the class:
using System; using System.IO.Pipes; using System.Runtime.Serialization.Formatters.Binary; namespace FunWithNamedPipes {
Daniel Schaffer
source share