public string Command(string command) { using (ClientPipe pipe = new ClientPipe(PipeName)) { if (!pipe.Connect()) return "ER Cannot connect to pipe server"; try { return pipe.Command(command); } catch (NamedPipes.PipeException e) { return "ER " + e.Message; } } }
private string Command(string command) { lock (PipeName) using (var pipe = new ClientPipe(PipeName)) { if (!pipe.Connect()) return "ER Cannot connect to pipe server"; try { return pipe.Command(command); } catch (PipeException e) { return "ER " + e.Message; } } }