Esempio n. 1
0
        public ProcessCommunicationServer(string nome_da_rota, string cliente, Action <Package> callback, int bufferSize = 102400)
        {
            this.nome_da_rota        = nome_da_rota;
            this.BufferSize          = bufferSize;
            this.Callback            = callback;
            ProcessCommunicationPost = new ProcessCommunicationPost(cliente);
            ContentByte = new List <byte>();

            Buffer = new byte[BufferSize];
            Stream = new NamedPipeServerStream(this.nome_da_rota, PipeDirection.In, 100, PipeTransmissionMode.Message, PipeOptions.Asynchronous);
        }
        static void Main()
        {
            Task.Delay(1000).Wait();

            // This is the content I want to send
            var cache = new CacheRecord
            {
                Id      = Guid.NewGuid().ToString(),
                Content = "content here"
            };

            while (true)
            {
                var retorno = new ProcessCommunicationPost("test-client").Post(cache, 30000);
                Console.WriteLine(retorno.Content);
                Console.ReadKey();
            }
        }