title: C# named pipes over a network
body: <p>I'm trying to make an app that requires communication over a network. I was following the MSDN doc for named pipes here: <a href="http://msdn.microsoft.com/en-us/library/bb546085.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb546085.aspx</a></p>
  
  <p>I've tried the code from MSDN but no luck.</p>
  
  <p>I saw that "." has to be replaced with the network name on the client side, which I did. I tried the network name and the server PC name but both failed to connect to the server (my laptop).</p>
  
  <p>Now I'm not sure what to do - any advice? (The code below gets me "The network path was not found")</p>
  
  <pre><code>using System;
  using System.IO;
  using System.IO.Pipes;
  
  class PipeClient
  {
      static void Main(string[] args)
      {
          using (NamedPipeClientStream pipeClient =
              new NamedPipeClientStream("xxx.xxx.x.x", "testpipe", PipeDirection.InOut))
          {
  
              // Connect to the pipe or wait until the pipe is available.
              Console.Write("Attempting to connect to pipe...");
              pipeClient.Connect();
  
              Console.WriteLine("Connected to pipe.");
              Console.WriteLine("There are currently {0} pipe server instances open.",
                 pipeClient.NumberOfServerInstances);
              using (StreamReader sr = new StreamReader(pipeClient))
              {
                  // Display the read text to the console
                  string temp;
                  while ((temp = sr.ReadLine()) != null)
                  {
                      Console.WriteLine("Received from server: {0}", temp);
                  }
              }
          }
          Console.Write("Press Enter to continue...");
          Console.ReadLine();
      }
  }
  </code></pre>