Example #1
0
        public void _Start()
        {
            var tcs = new TaskCompletionSource <object>();

            ThreadPool.QueueUserWorkItem(async _ => {
                try
                {
                    while (true)
                    {
                        Pipe = new NamedPipeServerStream(ServerName);

                        Report($"Pipe Server: {ServerName} created\nWating for connection");

                        Pipe.WaitForConnection();

                        var pipe = new DuplexServerPipe(Pipe);

                        await pipe.Run(Dispatcher);

                        pipe.Terminate();
                    }
                }
                catch (Exception e)
                {
                    tcs.SetException(e);
                }
            });
        }
Example #2
0
        public void Start()
        {
            Task.Run(async() =>
            {
                try
                {
                    while (true)
                    {
                        Pipe = new NamedPipeServerStream(ServerName);

                        Report($"Pipe Server: {ServerName} created\nWaiting for connection");

                        Pipe.WaitForConnection();

                        var pipe = new DuplexServerPipe(Pipe);

                        await pipe.Run(Dispatcher);

                        pipe.Terminate();
                    }
                }
                catch (Exception e)
                {
                    Report($"Error: {e.Message}");
                }
            });
        }