示例#1
0
        static void Main(string[] args)
        {
            // var svr = new ServerHandleImpl(DEFAULT_PORT);

            // svr.Start();

            // svr.Shutdown().Wait();

            // return;

            if (args.Length < 1)
            {
                Console.WriteLine(FALLBACK_HELP);
                return;
            }

            string command = args[0];

            if (command == "rpc")
            {
                int port;
                if (args.Length > 1)
                {
                    if (!int.TryParse(args[1], out port))
                    {
                        throw new ArgumentException($"Cannot parse port number from given argument {args[1]}." + '\n' + FALLBACK_HELP);
                    }
                }
                else
                {
                    port = DEFAULT_PORT;
                }

                var server = new ServerHandleImpl(port);

                server.Start();

                server.Shutdown().Wait();
            }
            else if (command == "mmf")
            {
                if (args.Length > 1)
                {
                    Console.WriteLine("run mmf");
                    MMFServer.Run(args[1]);
                }
                else
                {
                    Console.WriteLine("run mmf");
                    MMFServer.Run();
                }
            }
            else
            {
                Console.WriteLine(FALLBACK_HELP);
                return;
            }
        }
示例#2
0
        public static async Task DebugRun()
        {
            var server = new ServerHandleImpl(50052);

            server.Start();

            var channel = new Channel("localhost:50052", ChannelCredentials.Insecure);
            await channel.ConnectAsync();

            var stub = new SabberStonePython.API.SabberStonePython.SabberStonePythonClient(channel);

            int count = 100;
            var watch = Stopwatch.StartNew();

            FullRandomGame(stub, @"AAEBAf0EAA8MLU1xwwG7ApUDrgO/A4AEtATmBO0EoAW5BgA=", count);
            watch.Stop();
            Console.WriteLine($"{count} random games: {watch.ElapsedMilliseconds / 1000.0} sec");

            //server.Shutdown().Wait();
        }