Пример #1
0
        public ServerBase(int listenPort, string dbConnectString)
        {
            _rand = new Random();
            _playServers = new List<PlayServerInfo>();
            _expectedConnections = new Dictionary<string, int>();

            IPAddress[] IPS = Dns.GetHostAddresses(Dns.GetHostName());
            foreach (IPAddress ip in IPS)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                    _playServers.Add(new PlayServerInfo("Main Server", ip.ToString(), (ushort)listenPort));
            }

            // Start log thread
            LogThread log = new LogThread();

            // Start database thread
            if( dbConnectString != null )
                _db = new DatabaseThread(dbConnectString);

            // Start AI Thread
            _aiThread = new AIThread();

            _listenPort = listenPort;

            // Start input thread
            _inputThread = new InputThread();
        }
Пример #2
0
        public ServerBase(int listenPort, string dbConnectString)
        {
            _rand                = new Random();
            _playServers         = new List <PlayServerInfo>();
            _expectedConnections = new Dictionary <string, int>();

            IPAddress[] IPS = Dns.GetHostAddresses(Dns.GetHostName());
            foreach (IPAddress ip in IPS)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    _playServers.Add(new PlayServerInfo("Main Server", ip.ToString(), (ushort)listenPort));
                }
            }


            // Start log thread
            LogThread log = new LogThread();

            // Start database thread
            if (dbConnectString != null)
            {
                _db = new DatabaseThread(dbConnectString);
            }

            // Start AI Thread
            _aiThread = new AIThread();

            _listenPort = listenPort;

            // Start input thread
            _inputThread = new InputThread();
        }