public void Pipe_Reader() { // Open the named pipe. var server = new NamedPipeServerStream("Data"); if (this.InvokeRequired) { Engine_Activation_Delegate Engine_Activation = new Engine_Activation_Delegate(this.Engine_Activation); this.Invoke(Engine_Activation); } //Console.WriteLine("Waiting for connection..."); server.WaitForConnection(); //Console.WriteLine("Connected."); var br = new BinaryReader(server); //var bw = new BinaryWriter(server); int i = 0; bool Temp = true; // Checks If The Client Is Already Connected while (true) { try { var len = (int)br.ReadUInt32(); if (len == 0) MessageBox.Show("len equals zero"); if (Temp) { var str = new string(br.ReadChars(len)); // Read string if (i == 0) { //if (this.InvokeRequired) //{ // this.Invoke((MethodInvoker)delegate // { // MessageBox.Show(str); // }); //} Temp = false; i++; continue; } } else { var len2 = (int)9; if (len2 == 0) MessageBox.Show("len equals zero"); if (!Temp) { var str = new string(br.ReadChars(len)); // Read string if (this.InvokeRequired) { //this.Invoke((MethodInvoker)delegate //{ // MessageBox.Show("I == 1 " + str); //}); } Pipe_Writer(server); } } } catch { //MessageBox.Show("Error"); } } }
public void Pipe_Reader() { int i = 0; // Open the named pipe. var server = new NamedPipeServerStream("Data"); if (this.InvokeRequired) { Engine_Activation_Delegate Engine_Activation = new Engine_Activation_Delegate(this.Engine_Activation); this.Invoke(Engine_Activation); } //Console.WriteLine("Waiting for connection..."); server.WaitForConnection(); //Console.WriteLine("Connected."); var br = new BinaryReader(server); //var bw = new BinaryWriter(server); while (true) { try { i++; var len = (int)br.ReadUInt32(); if (len == 0) { MessageBox.Show("len equals zero"); } var str = new string(br.ReadChars(len)); // Read string if (i == 1) { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate { textBox1.Text += str; }); break; } } //if (i == 2) //{ // if (this.InvokeRequired) // { // this.Invoke((MethodInvoker)delegate // { // textBox3.Text += str; // }); // break; // } //} } catch { //MessageBox.Show("Error"); } } Pipe_Writer(server); }
public void Pipe_Reader() { int i = 0; // Open the named pipe. var server = new NamedPipeServerStream("Data"); if (this.InvokeRequired) { Engine_Activation_Delegate Engine_Activation = new Engine_Activation_Delegate(this.Engine_Activation); this.Invoke(Engine_Activation); } //Console.WriteLine("Waiting for connection..."); server.WaitForConnection(); //Console.WriteLine("Connected."); var br = new BinaryReader(server); //var bw = new BinaryWriter(server); while (true) { try { i++; var len = (int)br.ReadUInt32(); if (len == 0) MessageBox.Show("len equals zero"); var str = new string(br.ReadChars(len)); // Read string if (i == 1) { if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { textBox1.Text += str; }); break; } } //if (i == 2) //{ // if (this.InvokeRequired) // { // this.Invoke((MethodInvoker)delegate // { // textBox3.Text += str; // }); // break; // } //} } catch { //MessageBox.Show("Error"); } } Pipe_Writer(server); }
public void Pipe_Reader() { // Open the named pipe. var server = new NamedPipeServerStream("Data"); if (this.InvokeRequired) { Engine_Activation_Delegate Engine_Activation = new Engine_Activation_Delegate(this.Engine_Activation); this.Invoke(Engine_Activation); } //Console.WriteLine("Waiting for connection..."); server.WaitForConnection(); //Console.WriteLine("Connected."); var br = new BinaryReader(server); //var bw = new BinaryWriter(server); int i = 0; bool Temp = true; // Checks If The Client Is Already Connected while (true) { try { var len = (int)br.ReadUInt32(); if (len == 0) { MessageBox.Show("len equals zero"); } if (Temp) { var str = new string(br.ReadChars(len)); // Read string if (i == 0) { //if (this.InvokeRequired) //{ // this.Invoke((MethodInvoker)delegate // { // MessageBox.Show(str); // }); //} Temp = false; i++; continue; } } else { var len2 = (int)9; if (len2 == 0) { MessageBox.Show("len equals zero"); } if (!Temp) { var str = new string(br.ReadChars(len)); // Read string if (this.InvokeRequired) { //this.Invoke((MethodInvoker)delegate //{ // MessageBox.Show("I == 1 " + str); //}); } Pipe_Writer(server); } } } catch { //MessageBox.Show("Error"); } } }