Пример #1
0
 public void RecursiveResolveDomainName(DnsCache cache = null, NetProxy proxy = null, bool preferIPv6 = false, int retries = 2, int timeout = 2000, bool useTcp = false)
 {
     if (_ipEndPoint != null)
     {
         try
         {
             string ptrDomain = DnsClient.ParseResponsePTR(DnsClient.RecursiveQuery(new DnsQuestionRecord(_ipEndPoint.Address, DnsClass.IN), cache, proxy, preferIPv6, retries, timeout, useTcp));
             if (ptrDomain != null)
             {
                 _domainEndPoint = new DomainEndPoint(ptrDomain, _ipEndPoint.Port);
             }
         }
         catch
         { }
     }
 }
 public async Task RecursiveResolveDomainNameAsync(IDnsCache cache = null, NetProxy proxy = null, bool preferIPv6 = false, bool randomizeName = false, int retries = 2, int timeout = 2000)
 {
     if (_ipEndPoint != null)
     {
         try
         {
             IReadOnlyList <string> ptrDomains = DnsClient.ParseResponsePTR(await DnsClient.RecursiveResolveQueryAsync(new DnsQuestionRecord(_ipEndPoint.Address, DnsClass.IN), cache, proxy, preferIPv6, randomizeName, retries, timeout));
             if (ptrDomains != null)
             {
                 _domainEndPoint = new DomainEndPoint(ptrDomains[0], _ipEndPoint.Port);
             }
         }
         catch
         { }
     }
 }