예제 #1
0
 /// <summary>
 /// 关闭服务器端或客户端连接并释放所有关联的资源。
 /// </summary>
 public void Close()
 {
     try
     {
         _isClose           = true;
         _sessionTable      = null;
         this._HandlerID    = 0;
         this._isRun        = false;
         this._sessionTable = null;
         try
         {
             if (ClientSocket.Connected)
             {
                 ClientSocket.Shutdown(SocketShutdown.Both);
             }
         }
         catch { }
         this.ClientSocket.Close();
         agree.Close();
         agree = null;
     }
     catch
     {}
 }