Example #1
0
        private static void runServer()
        {
            Server server = new Server
            {
                Services = { RpcStreamingService.BindService(new RpcStreamingServiceImpl()) }, // 绑定我们的实现
                Ports    = { new ServerPort("localhost", 23333, ServerCredentials.Insecure) }
            };

            server.Start();
            server.Ports.ToList().ForEach(a => Console.WriteLine($"RpcStreamingService Server listening on port {a.Port}..."));
            Server server1 = new Server
            {
                Services = { MathService.BindService(new MathServiceImpl()) }, // 绑定我们的实现
                Ports    = { new ServerPort("localhost", 23334, ServerCredentials.Insecure) }
            };

            server1.Start();
            server1.Ports.ToList().ForEach(a => Console.WriteLine($"MathService Server listening on port {a.Port}..."));
        }