示例#1
0
 /// <summary>
 /// 根据客户端的会话ID来结束一个客户端会话
 /// </summary>
 /// <param name="sessionid"></param>
 public virtual void CloseClientSocket(string sessionid)
 {
     try
     {
         AppSession client = FindSession(sessionid);
         if (client != null)
         {
             if (_sessionTable.ContainsKey(sessionid))
             {
                 lock (LockObj)
                 {
                     _sessionTable.Remove(client.ID);
                     _concount = _concount - 1;
                     List <Thread> threads = _threadlist.Where(p => p.Name == sessionid).ToList();
                     if (threads != null)
                     {
                         foreach (Thread thrd in threads)
                         {
                             thrd.Abort();
                         }
                     }
                 }
                 client.Close();
             }
         }
     }
     catch (Exception ex)
     { }
 }
示例#2
0
 /// <summary>
 /// 根据客户端的会话ID来结束一个客户端会话
 /// </summary>
 /// <param name="sessionid"></param>
 public virtual void CloseClientSocket(string sessionid)
 {
     try
     {
         AppSession client = FindSession(sessionid);
         if (client != null)
         {
             if (_sessionTable.ContainsKey(sessionid))
             {
                 lock (LockObj)
                 {
                     _sessionTable.Remove(client.ID);
                     _concount = _concount - 1;
                     Thread thread = _threadlist.FirstOrDefault(p => p.Name == sessionid);
                     if (thread != null)
                     {
                         thread.Abort();
                     }
                 }
                 client.Close();
             }
         }
     }
     catch (Exception ex)
     { }
 }