Exemple #1
0
        /// <summary>
        /// 初始化服务
        /// </summary>
        /// <param name="uid">当前用户id</param>
        /// <returns></returns>
        public bool IniServer(string uid)
        {
            string IpEnd = UserInf.GetMySerInf(uid);

            if (IpEnd != "-1")
            {
                CheckOutIpPoint check  = new CheckOutIpPoint(IpEnd);
                IPAddress       Ad     = IPAddress.Parse(check.IpAdd);
                IPEndPoint      server = new IPEndPoint(Ad, 5281);
                qTcpListener = new TcpListener(server);
                qTcpListener.Start();
                ServerTh = new Thread(new ThreadStart(ServerIng));
                run      = true;
                ServerTh.Start();
                ServerTh.IsBackground = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }