Exemplo n.º 1
0
        /// <summary>
        /// 客户端实例
        /// </summary>
        /// <param name="ip">信息中心ip,应保证其合法性</param>
        /// <param name="port"></param>
        private Infocenter(string ip, int port, string user, string pwd)
        {
            _ip   = ip;
            _port = port;
            _user = user;
            _pwd  = pwd;

            if (string.IsNullOrEmpty(_ip) ||
                string.IsNullOrEmpty(_user) ||
                string.IsNullOrEmpty(_pwd) ||
                _port == 0
                )
            {
                Notified?.Invoke(CVResult.InfocenterParameterHappened, "服务器参数配置问题");
            }

            _connected = false;
            _remoteEP  = new IPEndPoint(IPAddress.Parse(ip), port);

            //本机特征
            _localIp   = Kits.GetIp();
            _localName = Environment.MachineName;
            Log.Added += AddLog;
        }