Exemple #1
0
        /// <summary>Ends an asynchronous request for DNS information.</summary>
        /// <returns>An array of type <see cref="T:System.Net.IPAddress" /> that holds the IP addresses for the host specified by the <paramref name="hostNameOrAddress" /> parameter of <see cref="M:System.Net.Dns.BeginGetHostAddresses(System.String,System.AsyncCallback,System.Object)" />.</returns>
        /// <param name="asyncResult">An <see cref="T:System.IAsyncResult" /> instance returned by a call to the <see cref="M:System.Net.Dns.BeginGetHostAddresses(System.String,System.AsyncCallback,System.Object)" /> method.</param>
        public static IPAddress[] EndGetHostAddresses(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }
            AsyncResult asyncResult2 = (AsyncResult)asyncResult;
            GetHostAddressesCallback getHostAddressesCallback = (GetHostAddressesCallback)asyncResult2.AsyncDelegate;

            return(getHostAddressesCallback.EndInvoke(asyncResult));
        }
Exemple #2
0
        public static IPAddress [] EndGetHostAddresses(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            if (use_mono_dns)
            {
                IPHostEntry entry = EndAsyncCall(asyncResult as DnsAsyncResult);
                if (entry == null)
                {
                    return(null);
                }
                return(entry.AddressList);
            }

            AsyncResult async           = (AsyncResult)asyncResult;
            GetHostAddressesCallback cb = (GetHostAddressesCallback)async.AsyncDelegate;

            return(cb.EndInvoke(asyncResult));
        }