Exemplo n.º 1
0
 private static void OnRead(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ReadAsyncResult thisPtr = (ReadAsyncResult)result.AsyncState;
         try
         {
             thisPtr._read += thisPtr._parent.BaseStream.EndRead(result);
             thisPtr.InvokeCallback();
         }
         catch (Exception e)
         {
             if (thisPtr.IsCompleted)
             {
                 throw;
             }
             thisPtr.InvokeCallback(e);
         }
     }
 }
Exemplo n.º 2
0
 private static void OnRead(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ReadAsyncResult thisPtr = (ReadAsyncResult)result.AsyncState;
         try
         {
             if (!thisPtr.CompleteRead(result))
             {
                 thisPtr.Read();
             }
         }
         catch (Exception e)
         {
             if (thisPtr.IsCompleted)
             {
                 throw;
             }
             thisPtr.InvokeCallback(e);
         }
     }
 }