コード例 #1
0
        /// <summary>
        /// 公有的构造函数,可以用来在一个程序中开多个客户端。
        /// 它没有启动公共Timer
        /// </summary>
        /// <param name="clientName"></param>
        public DNClient(string clientName = "unname client")
        {
            this.Name = clientName;
            _packet2  = new FastPacket2();

            token        = new Token();
            token.client = this;

            IsConnecting = false;
            IsInited     = false;
            //Init();
        }
コード例 #2
0
        /// <summary>
        /// 私有的构造函数,用来构造单例
        /// </summary>
        private DNClient()
        {
            if (_instance != null)
            {
                this.Dispose();
                _instance = null;
            }
            this.Name = "unname client";
            _packet2  = new FastPacket2();

            token        = new Token();
            token.client = this;

            IsConnecting = false;
            IsInited     = false;
            //Init();

            //启动公共Timer
            ClientTimer.GetInstance().Start();
        }