Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var grpcServer = new Grpc.Core.Server
            {
                Services = { ChatService.BindService(new ChatServiceImpl()) },
                Ports    = { new ServerPort(Host, Port, ServerCredentials.Insecure) }
            };

            grpcServer.Start();

            Console.WriteLine("Port: " + Port);
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            grpcServer.ShutdownAsync().Wait();
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            var server = new Grpc.Core.Server
            {
                Services = { ChatService.BindService(new ChatServiceImpl()) },
                Ports    = { new ServerPort("localhost", 5001, ServerCredentials.Insecure) }
            };

            // Start server
            server.Start();

            Console.WriteLine("ChatServer listening on port " + 5001);
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            await server.ShutdownAsync();
        }