title: NamedPipeServerStream and WaitForConnection method
body: <p>What bugs me when working with class <code>NamedPipeServerStream</code> is that for every incoming connection I need to create new object and call it's method <code>WaitForConnection</code>. </p>
  
  <p>What I want to do is to create one <code>NamedPipeServerStream</code> object, and then repeatedly in a while loop call aforementioned method, like that:</p>
  
  <pre><code>NamedPipeServerStream s2;
  using (s2 = new NamedPipeServerStream("pipe_name", PipeDirection.InOut)) {
      while(true) {
          ss2.WaitForConnection();
          //do something here
      }
  }
  </code></pre>
  
  <p>But when I do this, I get message </p>
  
  <blockquote>
    <p>Stream has been disconnected. </p>
  </blockquote>
  
  <p>Any advice?</p>