Exemplo n.º 1
0
        /// <summary>
        /// Add a server to the list.
        /// </summary>
        /// <param name="ip">IP of the server.</param>
        /// <param name="port">Port of the server.</param>
        /// <returns>The new server.</returns>
        public CServer Add(uint ip, ushort port)
        {
            if ((ip < Protocol.LowIDLimit) || (port == 0) || (port >= IPEndPoint.MaxPort - 4))
            {
                return(null);
            }

            if (this[ip, 0] == null)
            {
                CServer server = new CServer(ip, port);
                this.Add(server);
                CKernel.NewServer(server);
                return(server);
            }
            else
            {
                return(null);
            }
        }