internal override IAsyncResult BeginConnect(string hostName, int hostPort, AsyncCallback callback, object state)
{
base.CheckDisposed();
if (hostName == null)
{
throw new ArgumentNullException("hostName", "The value cannot be null.");
}
if ((hostPort < 0) || (hostPort > 0xffff))
{
throw new ArgumentOutOfRangeException("hostPort", "Value, specified for the port is out of the valid range.");
}
Connect_SO t_so = null;
this.SetProgress(true);
try
{
t_so = new Connect_SO(null, hostName, hostPort, callback, state);
if (this._resolveHostEnabled)
{
SocketBase.BeginGetHostByName(hostName, new AsyncCallback(this.Connect_GetHost_Host_End), t_so);
return(t_so);
}
SocketBase.BeginGetHostByName(base._proxyServer, new AsyncCallback(this.Connect_GetHost_Proxy_End), t_so);
}
catch (Exception exception)
{
this.SetProgress(false);
throw exception;
}
return(t_so);
}