aboutsummaryrefslogtreecommitdiffhomepage
path: root/grpc-common/csharp/GreeterClient/Program.cs
blob: 61c29762b127aede9010024674fdd3cb731835fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Grpc.Core;
using helloworld;

namespace GreeterClient
{
    class ClientMainClass
    {
        public static void Main(string[] args)
        {
            GrpcEnvironment.Initialize();

            using (Channel channel = new Channel("127.0.0.1:50051"))
            {
                var client = Greeter.NewStub(channel);
                String user = "you";

                var reply = client.SayHello(new HelloRequest.Builder { Name = user }.Build());
                Console.WriteLine("Greeting: " + reply.Message);
            }

            GrpcEnvironment.Shutdown();
        }
    }
}