public override void EndConnect(IAsyncResult asyncResult) {
if (SecureProtocol == SecureProtocol.None) {
base.EndConnect(asyncResult);
return;
}
// Make sure everything is in order
if (asyncResult == null)
throw new ArgumentNullException();
if (m_ConnectResult == null)
throw new InvalidOperationException();
if (asyncResult != m_ConnectResult)
throw new ArgumentException();
// Process the (secure) EndConnect
// block if the operation hasn't ended yet
AsyncResult ar = m_ConnectResult;
while(!ar.IsCompleted) {
ar.AsyncWaitHandle.WaitOne(200, false);
}
m_ConnectResult = null;
if (ar.AsyncException != null)
throw ar.AsyncException;
}
/// <summary>