예제 #1
0
        public Server()
        {
            Console.WriteLine("Initializing..." + Environment.NewLine);

            // Start the DB Connection
            try
            {
                Database = new GamespyDatabase();
            }
            catch
            {
                // The exception message will already be on the console
                return;
            }

            // Bind gpcm server on port 29900
            try
            {
                Console.WriteLine("<GPCM> Binding to port 29900");
                CmServer = new GpcmServer();
            }
            catch(Exception ex)
            {
                Console.WriteLine("Error binding to port 29900! " + ex.Message);
                Console.WriteLine("Press any key to close");
                Console.ReadKey();
                return;
            }

            // Bind gpsp server on port 29901
            try
            {
                Console.WriteLine("<GPSP> Binding to port 29901");
                SpServer = new GpspServer();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error binding to port 29901! " + ex.Message);
                Console.WriteLine("Press any key to close");
                Console.ReadKey();
                return;
            }

            // Let the client know we are ready for connections
            Console.Write(
                Environment.NewLine +
                "Ready for connections! Type 'help' for a list of commands" +
                Environment.NewLine + Environment.NewLine
            );
            Console.Beep();

            // Handle input
            while (isRunning)
            {
                CheckInput();
            }

            CmServer.Shutdown();
            SpServer.Shutdown();

            Console.WriteLine("Server shutdown Successfully");
        }
예제 #2
0
        public Server()
        {
            Console.WriteLine("Initializing..." + Environment.NewLine);

            // Start the DB Connection
            try
            {
                Database = new GamespyDatabase();
            }
            catch
            {
                // The exception message will already be on the console
                return;
            }

            // Bind gpcm server on port 29900
            try
            {
                Console.WriteLine("<GPCM> Binding to port 29900");
                CmServer = new GpcmServer();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error binding to port 29900! " + ex.Message);
                Console.WriteLine("Press any key to close");
                Console.ReadKey();
                return;
            }

            // Bind gpsp server on port 29901
            try
            {
                Console.WriteLine("<GPSP> Binding to port 29901");
                SpServer = new GpspServer();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error binding to port 29901! " + ex.Message);
                Console.WriteLine("Press any key to close");
                Console.ReadKey();
                return;
            }

            // Let the client know we are ready for connections
            Console.Write(
                Environment.NewLine +
                "Ready for connections! Type 'help' for a list of commands" +
                Environment.NewLine + Environment.NewLine
                );
            Console.Beep();

            // Handle input
            while (isRunning)
            {
                CheckInput();
            }

            CmServer.Shutdown();
            SpServer.Shutdown();

            Console.WriteLine("Server shutdown Successfully");
        }