Esempio n. 1
0
        protected override async Task <bool> OnFirstStart()
        {
            _server = GetProxy <IServerProxy>(_serverName);
            _server.AddRespondeeFork(_myName);

            using (ConsoleColorScope.SetForeground(ConsoleColor.Yellow))
            {
                _server.ReceiveMessageFork("\n!! Client: Hello World 3 Message #1!");
                Console.WriteLine("\n!! Client: Sent message #1.");
            }
            return(true);
        }
Esempio n. 2
0
        protected override async Task <bool> OnFirstStart()
        {
            _server = GetProxy <IServerProxy>(_serverName);

            using (ConsoleColorScope.SetForeground(ConsoleColor.Yellow))
            {
                var t1 = _server.ReceiveMessageAsync("\n!! Client: Hello World 3 Message #1!");
                Console.WriteLine("\n!! Client: Sent message #1.");

                var res1 = await t1;
                Console.WriteLine($"\n!! Client: Message #1 completed. Server acknowledges processing {res1} messages.");

                var t2 = _server.ReceiveMessageAsync("\n!! Client: Hello World 3 Message #2!");
                Console.WriteLine("\n!! Client: Sent message #2.");

                var res2 = await t2;
                Console.WriteLine($"\n!! Client: Message #2 completed. Server acknowledges processing {res2} messages.");

                Console.WriteLine("\n!! Client: Shutting down");
                Program.finishedTokenQ.Enqueue(0);
            }
            return(true);
        }