Example #1
0
        static async Task Main(string[] args)
        {
            var channel = GrpcChannel.ForAddress("https://localhost:5001");

            var client = new GetData.GetDataClient(channel);

            while (true)
            {
                Console.Write("Please enter the topic: ");
                string topic = Console.ReadLine();
                Console.Write("Please enter the message: ");
                string message = Console.ReadLine();
                var    input   = new ReceiveData {
                    Topic = topic, Message = message
                };
                var reply = await client.GetDataInfoAsync(input);

                //Console.WriteLine($"{reply.Message}");
            }

            /*var input = new HelloRequest { topic = "N***a" };
             * var reply = await client.SayHelloAsync(input);
             * Console.WriteLine(reply.Message);*/
            Console.ReadLine();
        }
Example #2
0
        static async Task Main(string[] args)
        {
            var channel = GrpcChannel.ForAddress("https://localhost:5001");

            var client = new GetData.GetDataClient(channel);

            Console.WriteLine("Receiver");
            Console.Write("Please enter the topic: ");
            string topic = Console.ReadLine();

            while (true)
            {
                Task.Delay(200);

                var input = new ReceiveData1 {
                    Topic1 = topic
                };

                var reply = await client.SendDataInfoAsync(input);

                if (reply.Message1 != "")
                {
                    Console.WriteLine(reply.Message1);
                }
            }
        }