private void CheckPipeOpen() { while (isPipeOpenCheckerRun) { if (!PipeStream.IsConnected) { PipeStream.Connect(); } else { PipeCheckerThread.Start(); isPipeOpenCheckerRun = false; PipeOpenCheckerThread.Abort(); } Thread.Sleep(2000); } }