Example #1
0
        private static async Task Test()
        {
            // The port number(5001) must match the port of the gRPC server.
            //
            using GrpcChannel channel = GrpcChannel.ForAddress("http://localhost:5000");
            var       client = new Greeter.GreeterClient(channel);
            EchoReply reply  = await client.EchoAsync(
                new EchoRequest
            {
                Name = "GreeterClient",
            });

            Console.WriteLine("Greeting: " + reply.Message);
            Console.WriteLine("Press any key to exit...");
        }
Example #2
0
        public async Task <EchoReply> EchoRequestAsync(string host, int bufferSize, int ttl, int timeout, CancellationToken token)
        {
            var result      = new EchoReply();
            var queryString = string.Format("{0}/{1}/{2}/{3}/{4}/", PathToServise, host, bufferSize, ttl, timeout);
            var json        = await Util.GetJson(queryString, token);

            var tempResult = JsonConvert.DeserializeObject <EchoReply>(json);

            if (tempResult != null)
            {
                result = tempResult;
            }
            else
            {
                result.Status = IPStatus.Invalide;
            }

            return(result);
        }