Ejemplo n.º 1
0
        private async Task RequestServer()
        {
            await channel.ConnectAsync(deadline : DateTime.UtcNow.AddSeconds(20));

            var client = new HelloService.HelloServiceClient(channel);
            await client.SayHelloAsync(new HelloRequest { Name = $"Luís" }, deadline : DateTime.UtcNow.AddSeconds(20));
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            // The port number(5001) must match the port of the gRPC server.
            using var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client = new HelloService.HelloServiceClient(channel);
            var reply  = await client.SayHelloAsync(
                new HelloRequest { Name = "Hello SwN Client" });

            Console.WriteLine("Greeting: " + reply.Message);
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static async Task Main(string[] args)
        {
            using var channel = GrpcChannel.ForAddress("http://localhost:5000");
            var client = new HelloService.HelloServiceClient(channel);

            var reply = await client.SayHelloAsync(
                new HelloRequest
            {
                Name = "Hello FSV Client"
            }
                );

            Console.WriteLine("Greetings: " + reply.Message);
            Console.ReadKey();
        }
Ejemplo n.º 4
0
        private static async Task UnaryCallExample(HelloService.HelloServiceClient client)
        {
            var reply = await client.SayHelloAsync(new HelloRequest { Name = "哈哈哈" });

            Console.WriteLine("Greeting: " + reply.Message);
        }