public override int EndReceive(IAsyncResult asyncResult) {
if (SecureProtocol == SecureProtocol.None)
return base.EndReceive(asyncResult);
// Make sure everything is in order
if (asyncResult == null)
throw new ArgumentNullException();
TransferItem ti = m_Controller.EndReceive(asyncResult);
if (ti == null)
throw new ArgumentException();
// Process the (secure) EndReceive
// block if the operation hasn't ended yet
while (!ti.AsyncResult.IsCompleted) {
ti.AsyncResult.AsyncWaitHandle.WaitOne(200, false);
}
if (ti.AsyncResult.AsyncException != null)
throw new SecurityException("An error occurs while communicating with the remote host.\r\n" + ti.AsyncResult.AsyncException.ToString(), ti.AsyncResult.AsyncException);
if (ti.Transferred == 0)
m_SentShutdownNotification = true;
return ti.Transferred;
}
/// <summary>