title: Named Pipe Communication between Node.js and .net
body: <p>I am working on an inter-process communication between a .net (v4.5.2) and Javascript node.js (v8.9.0) application. I want to use Windows named pipes for this (and only named pipes). For the Javascript application, I am using the named-pipes package (v0.0.1)
  I am able to establish a connection between the two applications which tells me that I am not completely off base here. I would expect to see the data event being triggered in the JavaScript application whenever I am writing a string to the NamedPipeServerStream but no data is received. I can not receive any data. Here is the code for .net and the JavaScript application. Any ideas why the data event is not being  triggered?</p>
  <p><em><strong>.Net Code</strong></em></p>
  <pre><code>using System;
  using System.IO;
  using System.IO.Pipes;
  
  namespace NamedPipes
  {
      class Program
      {
          static void Main(string[] args)
          {
              var server = new NamedPipeServerStream(&quot;XYZNamedPipe&quot;);
  
              Console.WriteLine(&quot;Waiting for Connection&quot;);
              server.WaitForConnection();
              Console.WriteLine(&quot;Connection Established&quot;);
              StreamWriter writer = new StreamWriter(server);
  
              int cnt = 0;
              while (true)
              {
                  string line = Console.ReadLine();
                  writer.WriteLine(++cnt.ToString() + &quot;: &quot; + line);
              }
          }
      }
  }
  </code></pre>
  <p><em><strong>JavaScript Code</strong></em></p>
  <pre><code>var NamedPipes = require(&quot;named-pipes&quot;);
  pipe = NamedPipes.connect('XYZNamedPipe')
  
  pipe.on('connect', (str) =&gt; {
      console.log('connection established'); 
  });
  
  pipe.on('data', (str) =&gt; {
      console.log('data received');   
      console.log(str); 
  });
  
  pipe.on('end', (str) =&gt; {
      console.log('end');       
  });
  </code></pre>