Esempio n. 1
0
        public static void StartServer()
        {
            if (serverRunning == true)
            {
                Console.WriteLine("The server is already running! You can't start the server again!");
            }
            else if (serverRunning == false)
            {
                settings.CheckConfigFile();

                listener = new TcpListener(IPAddress.Any, settings.ServerPort);

                Thread startServer = new Thread(StartListening);

                serverRunning = true;

                Console.WriteLine("The sever has been started successfully!");
                Console.WriteLine("External IP Address: {0}", GetExternalIPAddress());
                Console.WriteLine("Internal IP Address: {0}", GetInternalIPAddress());
                Console.WriteLine("Port: {0}", settings.ServerPort);

                startServer.Start();
            }
        }