BytesRoad.Net.Sockets.Socket_Socks4.Connect_GetHost_Proxy_End C# (CSharp) Method

Connect_GetHost_Proxy_End() private method

private Connect_GetHost_Proxy_End ( IAsyncResult ar ) : void
ar IAsyncResult
return void
        void Connect_GetHost_Proxy_End(IAsyncResult ar)
        {
            Connect_SO stateObj = (Connect_SO)ar.AsyncState;
            try
            {
                stateObj.UpdateContext();
                IPHostEntry host = EndGetHostByName(ar);
                if(null == host)
                    throw new SocketException(SockErrors.WSAHOST_NOT_FOUND);

                    // throw new HostNotFoundException("Unable to resolve proxy name.");

                IPEndPoint proxyEndPoint = ConstructEndPoint(host, _proxyPort);

                //------------------------------------
                // Connect to proxy server
                //
                _socket.BeginConnect(
                    proxyEndPoint, 
                    new AsyncCallback(Connect_Connect_End),
                    stateObj);
            }
            catch(Exception e)
            {
                stateObj.Exception = e;
                stateObj.SetCompleted();
            }
        }