protected void WriteWork(TaskProgress prog)
 {
     try
     {
         while (_HaveDataToSend.WaitOne())
         {
             try
             {
                 if (_Connection == null || !_Connection.IsConnectionAlive || _WriteDone)
                 {
                     return;
                 }
                 PendingSendData pending;
                 while (_PendingSend.TryDequeue(out pending))
                 {
                     if (pending._Req != null)
                     {
                         pending._Req.Send(_Connection);
                     }
                     else if (pending._Raw != null)
                     {
                         _Connection.Write(pending._Raw);
                     }
                 }
             }
             catch (ThreadAbortException)
             {
             }
             catch (Exception e)
             {
                 PlatDependant.LogError(e);
             }
         }
     }
     catch (ThreadAbortException)
     {
         Thread.ResetAbort();
     }
     catch (Exception e)
     {
         PlatDependant.LogError(e);
     }
 }
 protected void ReadWork(TaskProgress prog)
 {
     Update();
     _WriteDone = true;
     _HaveDataToSend.Set();
 }