Example #1
0
        static void Main(string[] args)
        {
            Channel channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure);

            var client = new gRPC.gRPCClient(channel);
            var reply  = client.SayHello(new HelloRequest {
                Name = "Zhang San"
            });

            Console.WriteLine("来自" + reply.Message);

            var reqult = client.Add(new AddRequest {
                A = 3, B = 5
            });

            Console.WriteLine(reqult.C);
            Console.WriteLine(reqult.Msg);

            var client2 = new QueryServie.QueryServieClient(channel);
            var resp    = client2.query(new SearchRequest {
                Query = "", PageNumber = 1, ResultPerPage = 20, Corpus = SearchRequest.Types.Corpus.Web
            });

            Console.WriteLine(resp);

            channel.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            Channel channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure);

            var client = new gRPC.gRPCClient(channel);
            var reply  = client.SayHello(new HelloRequest {
                Name = "LineZero"
            });

            Console.WriteLine("来自" + reply.Message);

            var reply2 = client.SayHi(new SayHiRequest {
                Name = "CK"
            });

            Console.WriteLine("来自" + reply2.Message);

            var reply3 = client.simpleHello(new SayWhat {
                Name = "CK", Message = "成功"
            });

            Console.WriteLine("来自" + reply3.Message + "---:" + reply3.Name);

            channel.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
Example #3
0
 static void Main(string[] args)
 {
     var channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure);
     var client = new gRPC.gRPCClient(channel);
     var replay = client.SayHello(new HelloRequest { Name = "shoy" });
     Console.WriteLine(replay.Message);
     channel.ShutdownAsync().Wait();
     Console.ReadKey();
 }
Example #4
0
        static void Main(string[] args)
        {
            var channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure);
            var client  = new gRPC.gRPCClient(channel);
            var replay  = client.SayHello(new HelloRequest {
                Name = "shoy"
            });

            Console.WriteLine(replay.Message);
            channel.ShutdownAsync().Wait();
            Console.ReadKey();
        }
Example #5
0
        static void Main(string[] args)
        {
            Channel channel = new Channel("127.0.0.1:7911", ChannelCredentials.Insecure);

            var client = new gRPC.gRPCClient(channel);
            var reply  = client.SayHello(new HelloRequest {
                Name = "WangWenHao"
            });

            Console.WriteLine("来自" + reply.Message);

            channel.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
Example #6
0
        static void Main(string[] args)
        {
            Channel channle = new Channel("127.0.0.1:12321", ChannelCredentials.Insecure);
            var     client  = new gRPC.gRPCClient(channle);
            var     result  = client.SayHello(new HelloRequest {
                Name = "niming"
            }) as HelloReply;
            var result1 = client.Getlsit(new HelloRequest {
                Name = "123456"
            }) as list1;
            string a = result1.Listbyte.ToString(Encoding.Default);

            Console.WriteLine(a);

            channle.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
Example #7
0
        static void Main(string[] args)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
            Console.InputEncoding  = Encoding.GetEncoding("GB2312");
            Channel channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure);

            var client = new gRPC.gRPCClient(channel);
            var reply  = client.SayHello(new HelloRequest {
                Name = "LineZero"
            });

            Console.WriteLine("来自" + reply.Message);

            channel.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
Example #8
0
        static void Main(string[] args)
        {
            Channel channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure);

            try
            {
                var client = new gRPC.gRPCClient(channel);
                var reply  = client.SayHello(new HelloRequest {
                    Name = "Test"
                });
                Console.WriteLine("reply message:" + reply.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            channel.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
Example #9
0
        static void Main(string[] args)
        {
            Channel channel = new Channel("127.0.0.1:8082", ChannelCredentials.Insecure);

            var client = new gRPC.gRPCClient(channel);
            var reply  = client.SayHello(new TestRequest {
                Name = "jeno"
            });

            Console.WriteLine("2333 SayHello Return: " + reply.Message);

            var reply2 = client.Add(new AddTarget {
                V1 = 6, V2 = 7
            });

            Console.WriteLine("V1=6,V2=7 Add Return: " + reply2.Sum);

            channel.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
Example #10
0
        static void Main(string[] args)
        {
            Channel channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure);

            var client = new gRPC.gRPCClient(channel);
            var reply  = client.SayHello(new HelloRequest {
                Name = "LineZero"
            });

            Console.WriteLine("来自:" + reply.Message);
            string user        = "******";
            var    secondReply = client.SayHelloAgain(new HelloRequest {
                Name = user
            });

            Console.WriteLine("来自: " + secondReply.Message);

            channel.ShutdownAsync().Wait();
            Console.WriteLine("任意键退出...");
            Console.ReadKey();
        }
 public static TestReply SayHello(TestRequest request)
 {
     return(client.SayHello(request));
 }