BeginGetHostByName() 정적인 개인적인 메소드

static private BeginGetHostByName ( string hostName, AsyncCallback cb, object state ) : IAsyncResult
hostName string
cb AsyncCallback
state object
리턴 IAsyncResult
        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);
        }
        internal override IAsyncResult BeginConnect(EndPoint remoteEP, AsyncCallback callback, object state)
        {
            base.CheckDisposed();
            Connect_SO t_so = null;

            this.SetProgress(true);
            try
            {
                t_so = new Connect_SO(remoteEP, -1, callback, state);
                SocketBase.BeginGetHostByName(base._proxyServer, new AsyncCallback(this.Connect_GetHost_Proxy_End), t_so);
            }
            catch (Exception exception)
            {
                this.SetProgress(false);
                throw exception;
            }
            return(t_so);
        }
        internal override IAsyncResult BeginBind(SocketBase baseSocket, AsyncCallback callback, object state)
        {
            base.CheckDisposed();
            Bind_SO d_so = null;

            this.SetProgress(true);
            try
            {
                d_so = new Bind_SO(baseSocket, callback, state);
                SocketBase.BeginGetHostByName(base._proxyServer, new AsyncCallback(this.Bind_GetHost_End), d_so);
            }
            catch (Exception exception)
            {
                this.SetProgress(false);
                throw exception;
            }
            return(d_so);
        }
        internal override IAsyncResult BeginConnect(string hostName, int port, AsyncCallback callback, object state)
        {
            base.CheckDisposed();
            Connect_SO t_so = null;

            this.SetProgress(true);
            try
            {
                t_so = new Connect_SO(null, port, callback, state);
                SocketBase.BeginGetHostByName(hostName, new AsyncCallback(this.Connect_GetHost_Host_End), t_so);
            }
            catch (Exception exception)
            {
                this.SetProgress(false);
                throw exception;
            }
            return(t_so);
        }
        private void Connect_GetHost_Host_End(IAsyncResult ar)
        {
            Connect_SO asyncState = (Connect_SO)ar.AsyncState;

            try
            {
                asyncState.UpdateContext();
                IPHostEntry host = SocketBase.EndGetHostByName(ar);
                if (host != null)
                {
                    asyncState.RemoteEndPoint = SocketBase.ConstructEndPoint(host, asyncState.HostPort);
                }
                SocketBase.BeginGetHostByName(base._proxyServer, new AsyncCallback(this.Connect_GetHost_Proxy_End), asyncState);
            }
            catch (Exception exception)
            {
                asyncState.Exception = exception;
                asyncState.SetCompleted();
            }
        }
        internal override IAsyncResult BeginBind(SocketBase baseSocket, AsyncCallback callback, object state)
        {
            base.CheckDisposed();
            if (baseSocket == null)
            {
                throw new ArgumentNullException("baseSocket", "The value cannot be null");
            }
            Bind_SO d_so = null;

            this.SetProgress(true);
            try
            {
                d_so = new Bind_SO((Socket_Socks5)baseSocket, callback, state);
                SocketBase.BeginGetHostByName(base._proxyServer, new AsyncCallback(this.Bind_GetHost_End), d_so);
            }
            catch (Exception exception)
            {
                this.SetProgress(false);
                throw exception;
            }
            return(d_so);
        }