Example #1
0
        private void DnsQueryCallback(IAsyncResult ar)
        {
            IPAddress[] array;
            DnsStatus   dnsStatus = Dns.EndResolveToAddresses(ar, out array);
            bool        isMatch   = false;

            if (dnsStatus == DnsStatus.Success)
            {
                isMatch = this.MatchResult(array);
            }
            Provider.QueryAsyncResult queryAsyncResult = (Provider.QueryAsyncResult)ar.AsyncState;
            queryAsyncResult.QueryCompleted(isMatch, array);
        }
Example #2
0
        private IPAddress[] ResolveInboundVirtualIPs(Dns dns, int partnerId, string fqdnTemplate)
        {
            string       domainName  = string.Format(fqdnTemplate, partnerId);
            IAsyncResult asyncResult = dns.BeginResolveToAddresses(domainName, AddressFamily.InterNetwork, null, null);

            asyncResult.AsyncWaitHandle.WaitOne();
            IPAddress[] result;
            DnsStatus   dnsStatus = Dns.EndResolveToAddresses(asyncResult, out result);

            if (dnsStatus != DnsStatus.Success)
            {
                base.WriteError(new InvalidOperationException("Unable to resolve inbound IPs.  Dns status = " + dnsStatus), ErrorCategory.InvalidOperation, null);
            }
            return(result);
        }