コード例 #1
0
        public static void Main(string[] args)
        {
            XmlConfigurator.Configure();

            try
            {
                if (!ServerOptions.TryGetArguments(args, out var parsedArguments))
                {
                    return;
                }

                var server = new ClusterServer(parsedArguments, Log);
                server.Start();

                Console.ReadLine();
                Log.InfoFormat("Server stopped!");
            }
            catch (Exception e)
            {
                Log.Fatal(e);
            }
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            // XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()), new FileInfo("log4net.config"));

            try
            {
                if (!ServerOptions.TryGetArguments(args, out var parsedArguments))
                {
                    return;
                }

                var server = new ClusterServer(parsedArguments);
                server.Start();

                Console.WriteLine("Press ENTER to stop listening");
                Console.ReadLine();
                Console.WriteLine("Server stopped!");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #3
0
        public static void Main(string[] args)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()), new FileInfo("log4net.config"));

            try
            {
                Task.Run(() =>
                {
                    var parsedArguments = new ServerOptions()
                    {
                        Port           = 8060,
                        Async          = true,
                        MethodDuration = 500,
                        MethodName     = "qqq",
                    };
                    var server = new ClusterServer(parsedArguments, log);
                    server.Start();

                    log.InfoFormat("Press ENTER to stop listening");
                    Console.ReadLine();
                    log.InfoFormat("Server stopped!");
                });
                Task.Run(() =>
                {
                    var parsedArguments = new ServerOptions()
                    {
                        Port           = 31337,
                        Async          = true,
                        MethodDuration = 1000,
                        MethodName     = "qqq",
                    };
                    var server = new ClusterServer(parsedArguments, log);
                    server.Start();

                    log.InfoFormat("Press ENTER to stop listening");
                    Console.ReadLine();
                    log.InfoFormat("Server stopped!");
                });

                Task.Run(() =>
                {
                    var parsedArguments = new ServerOptions()
                    {
                        Port           = 8010,
                        Async          = true,
                        MethodDuration = 1500,
                        MethodName     = "qqq",
                    };
                    var server = new ClusterServer(parsedArguments, log);
                    server.Start();

                    log.InfoFormat("Press ENTER to stop listening");
                    Console.ReadLine();
                    log.InfoFormat("Server stopped!");
                });

                Task.Run(() =>
                {
                    var parsedArguments = new ServerOptions()
                    {
                        Port           = 8020,
                        Async          = true,
                        MethodDuration = 2000,
                        MethodName     = "qqq",
                    };
                    var server = new ClusterServer(parsedArguments, log);
                    server.Start();

                    log.InfoFormat("Press ENTER to stop listening");
                    Console.ReadLine();
                    log.InfoFormat("Server stopped!");
                }).Wait();
            }
            catch (Exception e)
            {
                log.Fatal(e);
            }
        }