Calling the NamedPipeServerStream.Disconnect method will block until all the sent characters have been read unless the transmission mode of the pipe is set to PipeTransmissionMode.Message and the buffer size is set in the constructor that created the System.IO.Pipes.NamedPipeServerStream object. In this case, not all of the messages will be received. Calling PipeStream.WaitForPipeDrain causes the server to block until all the data has been read from the pipe.