Пример #1
0
        static async Task Main(string[] args)
        {
            using var channel = GrpcChannel.ForAddress("https://localhost:5021");

            var calcClient = new Calc.CalcClient(channel);
            var addreply   = await calcClient.AddAsync(
                new AddRequest { A = 2, B = 3 }
                );

            Console.WriteLine(addreply.C);

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Пример #2
0
        public static void Main()
        {
            var channel = new Channel(Address, Port, ChannelCredentials.Insecure);
            var client  = new Calc.CalcClient(channel);

            var request = new Request
            {
                Num1 = 40,
                Num2 = 2
            };

            var response = client.AddAsync(request).GetAwaiter().GetResult();

            Console.WriteLine($"Addition result: {response.Payload.Deserialize().Result}");

            channel.ShutdownAsync().GetAwaiter().GetResult();
        }