Exemplo n.º 1
0
        //dotnet ChatServer.dll --uniqueID 1 --roomMaxCount 16 --roomMaxUserCount 4 --roomStartNumber 1 --maxUserCount 100
        static void Main(string[] args)
        {
            var serverOption = ParseCommandLine(args);

            if (serverOption == null)
            {
                return;
            }


            var serverApp = new MainServer();

            serverApp.InitConfig(serverOption);

            serverApp.CreateStartServer();

            MainServer.MainLogger.Info("Press q to shut down the server");

            while (true)
            {
                System.Threading.Thread.Sleep(50);

                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);
                    if (key.KeyChar == 'q')
                    {
                        Console.WriteLine("Server Terminate ~~~");
                        serverApp.StopServer();
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        //dotnet ChatServer.dll --uniqueID 1 --roomMaxCountPerThread 16 --roomThreadCount 4 --roomMaxUserCount 4 --roomStartNumber 1 --dbWorkerThreadCount 4 --redisAddress 192.168.0.10 --maxUserCount 100
        static void Main(string[] args)
        {
            var serverOption = ParseCommandLine(args);

            if (serverOption == null)
            {
                return;
            }

            var workProcessTimer = new System.Timers.Timer(32);

            workProcessTimer.Elapsed += (s, e) => OnProcessTimedEvent(s, e);
            workProcessTimer.Start();

            var ServerApp = new MainServer();

            ServerApp.CreateStartServer();
            var error = ServerApp.CreateComponent();

            (error == CSBaseLib.ERROR_CODE.NONE).IfFalse(() =>
            {
                var errorMsg = string.Format("서버 컴포넌트 생성 실패. {0}: {1}", error, error.ToString());
                MainServer.WriteLog(errorMsg, CommonServerLib.LOG_LEVEL.INFO);
            });

            while (true)
            {
                System.Threading.Thread.Sleep(50);

                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);
                    if (key.KeyChar == 'q')
                    {
                        Console.WriteLine("Server Terminate ~~~");
                        ServerApp.StopServer();
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var serverOption = ParseCommandLine(args);

            if (serverOption == null)
            {
                return;
            }


            var serverApp = new MainServer();

            serverApp.InitConfig(serverOption);
            serverApp.CreateStartServer();
            MainServer.MainLogger.Info("Press q to shut down the server");

            while (true)
            {
                System.Threading.Thread.Sleep(50);
            }
        }