Пример #1
0
        static void Main(string[] args)
        {
            const int Port = 50052;

            Grpc.Core.Server server = new Grpc.Core.Server
            {
                Services = { ChatService.BindService(new ChatServerImpl()) },
                Ports    = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
            };
            server.Start();

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

            server.ShutdownAsync().Wait();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            // Build server
            var server = new Server
            {
                Services = { ChatService.BindService(new ChatServiceImpl()) },
                Ports    = { new ServerPort(Host, Port, ServerCredentials.Insecure) }
            };

            // Start server
            server.Start();

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

            server.ShutdownAsync().Wait();
        }
Пример #3
0
        static void Main(string[] args)
        {
            var server = new NamedPipeServer("Test");

            ChatService.BindService(server.ServiceBinder, new ChatServiceImplementation());
            PowerChatService.BindService(server.ServiceBinder, new PowerChatServiceImplementation());

            try
            {
                Console.WriteLine("Starting service.");
                server.Start();

                Console.WriteLine("Service running.");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.ReadKey();
            }
        }