示例#1
0
        private static void Main(string[] args)
        {
            XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net_wServer.config"));

            Settings = new SimpleSettings("wServer");

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            svrSkt = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            svrSkt.Bind(new IPEndPoint(IPAddress.Any, 2050));
            svrSkt.Listen(0xff);
            svrSkt.BeginAccept(Listen, null);
            Console.CancelKeyPress += (sender, e) =>
            {
                logger.Info("Saving Please Wait...");
                svrSkt.Close();
                foreach (var i in RealmManager.Clients.Values.ToArray())
                {
                    i.Save();
                    i.Disconnect();
                }
                logger.Info("Closing...");
                Thread.Sleep(500);
                Environment.Exit(0);
            };

            logger.Info("Listening at port 2050...");

            HostPolicyServer();

            RealmManager.CoreTickLoop();    //Never returns
        }
示例#2
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            svrSkt = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            svrSkt.Bind(new IPEndPoint(IPAddress.Any, 2050));
            svrSkt.Listen(0xff);
            svrSkt.BeginAccept(Listen, null);
            Console.CancelKeyPress += (sender, e) =>
            {
                Console.WriteLine("Saving Please Wait...");
                svrSkt.Close();
                foreach (var i in RealmManager.Clients.Values.ToArray())
                {
                    i.Save();
                    i.Disconnect();
                }
                Console.WriteLine("\nClosing...");
                Thread.Sleep(500);
                Environment.Exit(0);
            };

            Console.WriteLine("Listening at port 2050...");

            HostPolicyServer();

            RealmManager.CoreTickLoop();    //Never returns
        }
示例#3
0
        static void Main(string[] args)                       //Main
        {
            ILog log = LogManager.GetLogger(typeof(Program)); //Added

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            svrSkt = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            svrSkt.Bind(new IPEndPoint(IPAddress.Any, 2050));
            svrSkt.Listen(0xff);
            svrSkt.BeginAccept(Listen, null);
            Console.CancelKeyPress += (sender, e) =>
            {
                Console.WriteLine("Saving Please Wait...");
                svrSkt.Close();
                foreach (var i in RealmManager.Clients.Values.ToArray())
                {
                    i.Save();
                    i.Disconnect();
                }
                Console.WriteLine("\nClosing...");
                Thread.Sleep(100);
                Environment.Exit(0);
            };

            Console.ForegroundColor = ConsoleColor.Green;
            Console.Title           = "Server Engine";
            Console.WriteLine("Accepting connections at port " + port + ".");
            HostPolicyServer();
            RealmManager.CoreTickLoop();
        }
示例#4
0
        static void Main(string[] args)
        {
            try
            {
                svrSkt = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                svrSkt.Bind(new IPEndPoint(IPAddress.Any, 2050));
                svrSkt.Listen(0xff);
                svrSkt.BeginAccept(Listen, null);
                Console.CancelKeyPress += (sender, e) =>
                {
                    Console.WriteLine("Terminating...");
                    svrSkt.Close();
                    foreach (var i in RealmManager.Clients.Values.ToArray())
                    {
                        i.Disconnect();
                    }
                    Environment.Exit(0);
                };
                Console.WriteLine("Listening at port 2050...");

                HostPolicyServer();

                RealmManager.CoreTickLoop();    //Never returns
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.ToString());
                Console.ReadLine();
            }
        }