public void Test_StartListening()
        {
            PipeServerChannel serverChannel = new PipeServerChannel("testpipe");

            serverChannel.StartListening();

            serverChannel.Dispose();
        }
        public void Test_StartListening_ReceiveResponseHandler()
        {
            Thread t = new Thread(this.RunPipeClient);
            t.Start();

            PipeServerChannel serverChannel = new PipeServerChannel("testpipe");
            serverChannel.ReceiveResponseEventHandler += ReceiveResponse;

            serverChannel.StartListening();

            Thread.Sleep(1000);

            Thread t2 = new Thread(this.RunPipeClient);
            t2.Start();

            Thread.Sleep(1000);

            serverChannel.Close();

            serverChannel.Dispose();
        }
Exemplo n.º 3
0
        private void SetupServerChannel(string pipeName, int? id, string name)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(pipeName))
                {
                    this.pipeServerChannel = new PipeServerChannel(pipeName);
                    this.pipeServerChannel.StartListening();

                    this.pipeServerChannel.ReceiveResponseEventHandler += this.HandleNotification;

                    Logger.InfoFormat("Setup the PipeServerChannel with the pipe name - {0}", pipeName);
                }
                else
                {
                    if ((id != null) && (!string.IsNullOrWhiteSpace(name)))
                    {
                        string pn = name + id.Value.ToString();
                        this.pipeServerChannel = new PipeServerChannel(pn);
                        this.pipeServerChannel.StartListening();

                        this.pipeServerChannel.ReceiveResponseEventHandler += this.HandleNotification;

                        Logger.InfoFormat("Setup the PipeServerChannel with the pipe name - {0}", pn);
                    }
                }
            }
            catch { }
        }
        public void Test_Constructor()
        {
            PipeServerChannel serverChannel = new PipeServerChannel("testpipe");

            serverChannel.Dispose();
        }