public void Setup()
 {
     _channel = GrpcChannel.ForAddress("https://localhost:5001");
     _echoer  = new Echoer.EchoerClient(_channel);
     _payload = new byte[PayloadBytes];
     new Random().NextBytes(_payload);
 }
示例#2
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Say something");
            var userInput = Console.ReadLine();

            // The port number(5001) must match the port of the gRPC server.
            using var channel = GetGrpcChannel();
            var client = new Echoer.EchoerClient(channel);
            var reply  = await client.SayAsync(
                new SayRequest { Message = userInput });

            Console.WriteLine("Received reply: " + reply.Message);
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }