internal IAsyncResult UnsafeBeginConnect(EndPoint remoteEP, AsyncCallback callback, object state, bool flowContext = false)
{
if (CanUseConnectEx(remoteEP))
{
return BeginConnectEx(remoteEP, flowContext, callback, state);
}
EndPoint endPointSnapshot = remoteEP;
var asyncResult = new ConnectAsyncResult(this, endPointSnapshot, state, callback);
// For connectionless protocols, Connect is not an I/O call.
Connect(remoteEP);
asyncResult.FinishPostingAsyncOp();
// Synchronously complete the I/O and call the user's callback.
asyncResult.InvokeCallback();
return asyncResult;
}