C# Guru - Named Pipes IO for Inter-process Communication
It's time for another TechNet Guru winner!
Congratulations to Dan Randolph, our VB Guru winner for June 2013! To find all the competitors for June (and more information about this monthly contest), see the Wiki article: TechNet Guru Contributions for June 2013.
Dan's blog: https://danrandolph.blogspot.com/
Dan won with this fantastic contribution:
Named Pipes IO for Inter-process Communication
Visual C# Technical Guru - June 2013 |
Dan Randolph | Named Pipes IO for Inter-process Communication | Christian Lukito: "Good proof of concept showing how to use the API. But it will be more better if can provide real worlds example in what way this is more useful."Ed Price: "Very clear and easy to read! Great code snippets with good formatting!" |
We've got new blood for the Visual C# category! Let's see if the contributors from May want to take on Dan in July (the contributions are already starting to come in).
Here's an excerpt from the article:
PipeClient
Here is the button1_Click code snippet from the client project. All of the work in the demo client is done on the button click. A StreamWriter is simply connected to the NamedPipeClientStream, and the contents of the Textblock are written to the pipe stream for each button click.
privatevoid button1_Click( ``object sender, RoutedEventArgs e)
{
``using (NamedPipeClientStream pipeClient = ``newNamedPipeClientStream(``"."`` , ``"testpipe"`` ,
`` PipeDirection.Out,
`` PipeOptions.Asynchronous))
`` {
`` tbStatus.Text = ``"Attempting to connect to pipe..."`` ;
``try
`` {
`` pipeClient.Connect(2000);
`` }
``catch
`` {
``MessageBox.Show(``"The Pipe server must be started in order to send data to it."`` );
``return`` ;
`` }
`` tbStatus.Text = ``"Connected to pipe."`` ;
``using (StreamWriter sw = ``new StreamWriter(pipeClient))
`` {
`` sw.WriteLine(tbClientText.Text);
`` }
`` }
`` tbStatus.Text = ``""`` ;
}
==================
Read the rest here:
Named Pipes IO for Inter-process Communication
Thanks to Dan Randolph for your great contribution to the TechNet Guru contest! You can read about all the June winners here: TechNet Guru Award Winners - June 2013
Also, for the August Guru competition, see TechNet Guru Contributions - August 2013 .
Are you a Wiki Ninja? https://technet.com/wiki
- User Ed
Comments
- Anonymous
January 31, 2016
Computers Today (part 1 of 6) blogs.msdn.com/.../computers-today.aspx ..... CS SPOTLIGHT: Girls in computer programming... why it matters!!! blogs.msdn.com/.../cs-spotlight-girls-in-computer-programming-why-it-matters.aspx ... Computational Thinking - Videos & Papers by Jeannette Wing blogs.msdn.com/.../computational-thinking-videos-amp-papers-by-jeannette-wing.aspx