static void Main(string[] args) { PipeClient client = new PipeClient(); while (true) { Console.Write(":"); client.WriteLine(Console.ReadLine()); } }
// Creates a new pipe server void CreateNewPipeClient() { if (pipeClient != null) { pipeClient.MessageReceived -= pipeClient_MessageReceived; pipeClient.ServerDisconnected -= pipeClient_ServerDisconnected; } pipeClient = new PipeClient(); pipeClient.MessageReceived += pipeClient_MessageReceived; pipeClient.ServerDisconnected += pipeClient_ServerDisconnected; }
// Method to create Pipe Client Object with message receive and disconnect parameters private void CreateNewPipeClient() { if (this.pipeClient != null) { this.pipeClient.MessageReceived -= this.PipeClient_MessageReceived; this.pipeClient.ServerDisconnected -= this.PipeClient_ServerDisconnected; } // Initialise pipeClient Object this.pipeClient = new PipeClient(); this.pipeClient.MessageReceived += this.PipeClient_MessageReceived; this.pipeClient.ServerDisconnected += this.PipeClient_ServerDisconnected; }