예제 #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
파일: StaClient.cs 프로젝트: zsybupt/bond
        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();
        }