Exemplo n.º 1
0
 internal ServerNamedPipe(string name, uint outBuffer, uint inBuffer, int maxReadBytes, bool secure)
 {
     PipeConnection          = new ServerPipeConnection(name, outBuffer, inBuffer, maxReadBytes, secure);
     PipeThread              = new Thread(new ThreadStart(PipeListener));
     PipeThread.IsBackground = true;
     PipeThread.Name         = "Pipe Thread " + this.PipeConnection.NativeHandle.ToString();
     LastAction              = DateTime.Now;
 }
Exemplo n.º 2
0
        private GoJanusListener(IServiceProvider provider)
        {
            _provider   = provider;
            _connection = new ServerPipeConnection(_pipeName, 512, 512, 5000);
            var th = new Thread(Listen)
            {
                IsBackground     = true,
                Priority         = ThreadPriority.Lowest,
                CurrentUICulture = Thread.CurrentThread.CurrentUICulture
            };

            th.Start();
        }
Exemplo n.º 3
0
        public void StartPipeServer()
        {
            isListening = true;
            ServerPipeConnection PipeConnection = new ServerPipeConnection(pipeName, 512, 512, 5000, false);

            Task.Run(() =>
            {
                while (isListening)
                {
                    PipeConnection.Disconnect();
                    PipeConnection.Connect();
                    try
                    {
                        string request = PipeConnection.Read();
                        onMessage?.Invoke(this, JsonConvert.DeserializeObject <pipeMessageData <object> >(request));
                    }
                    catch (Exception ex)
                    {
                    }
                }
                PipeConnection.Dispose();
            });
        }