void Bind_GetHost_End(IAsyncResult ar)
{
Bind_SO stateObj = (Bind_SO)ar.AsyncState;
try
{
stateObj.UpdateContext();
IPHostEntry host = EndGetHostByName(ar);
if(host == null)
throw new SocketException(SockErrors.WSAHOST_NOT_FOUND);
// throw new HostNotFoundException("Unable to resolve proxy host name.");
IPEndPoint proxyEndPoint = ConstructEndPoint(host, _proxyPort);
stateObj.ProxyIP = proxyEndPoint.Address;
//------------------------------------
// Connect to proxy server
//
_socket.BeginConnect(
proxyEndPoint,
new AsyncCallback(Bind_Connect_End),
stateObj);
}
catch(Exception e)
{
stateObj.Exception = e;
stateObj.SetCompleted();
}
}