title: NamedPipeServerStream C# proper usage - I keep getting IOExceptions
body: <p>I've been searching for a while but it seems to be difficult to find any definite answers on how to recover from exceptions thrown by calling NamedPipeServerStream.BeginWaitForConnection. I have an application that sets up a named pipe server on a well known name and listens for messages to perform certain actions. </p>
  
  <p>It works fine and dandy until the application is restarted. This usually results in an IOException saying, "The pipe is being closed." How can I correctly recover from this exception and use the same name for my named pipe? Any good resources on a good production worthy implementation of a named pipe server would be appreciated.</p>