Example #1
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Usage: pcs.exe <server path> <client path>");
                return;
            }

            const int PCS_PORT = 10000;

            string serverPath = args[0];
            string clientPath = args[1];

            PCS pcs = new PCS(serverPath, clientPath);

            AppContext.SetSwitch(
                "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

            PCSService pcsService = new PCSService(pcs);

            Grpc.Core.Server server = new Grpc.Core.Server
            {
                Services =
                {
                    PCSGrpcService.BindService(pcsService)
                },
                Ports = { new ServerPort("0.0.0.0", PCS_PORT, ServerCredentials.Insecure) }
            };

            server.Start();

            Console.WriteLine("Press any key to stop PCS...");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }