Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6882793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:17:59+00:00 2026-05-27T05:17:59+00:00

I am using Indy to perform a reverse IPv4 lookup using the following code.

  • 0

I am using Indy to perform a reverse IPv4 lookup using the following code.

function ReverseDNSLookup(const IPAddress: String; const DNSServer: String; Timeout, Retries: Integer; var HostName: String): Boolean;
var
  AIdDNSResolver: TIdDNSResolver;
  RetryCount: Integer;
begin
  Result := FALSE;

  AIdDNSResolver := TIdDNSResolver.Create(nil);
  try
    AIdDNSResolver.QueryResult.Clear;
    AIdDNSResolver.WaitingTime := Timeout; 
    AIdDNSResolver.QueryType := [qtPTR];
    AIdDNSResolver.Host := DNSServer;

    RetryCount := Retries;
    repeat
      try
        dec(RetryCount);

        AIdDNSResolver.Resolve(IPAddress);

        Break;
      except
        on e: Exception do
        begin
          if RetryCount <= 0 then
          begin
            if SameText(e.Message, RSCodeQueryName) then
              Result := FALSE
            else
              raise Exception.Create(e.Message);

            Break;
          end;
        end;
      end;
    until FALSE;

    Result := AIdDNSResolver.QueryResult.Count > 0;

    if Result then
    begin
      Result := TRUE;
      HostName := ParseReverseDNSResult(AIdDNSResolver.QueryResult[0].RData);
    end;
  finally
    FreeAndNil(AIdDNSResolver);
  end;
end;

What do I need to change in order to make it compatible with IPv6?

I know I can use getaddrinfo, but in this particular case I need to contact the DNS server directly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:17:59+00:00Added an answer on May 27, 2026 at 5:17 am

    You don’t have to do anything. For qtPTR queries, Resolve() automatically detects whether the address is IPv4 or IPv6 and formats the query accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having problem with IdTCPclient.connected function from Indy in Delphi. I am using
I have the following task: download a file using HTTPS and authentication. Indy seems
I'm using the IdFTP (Indy 10) component to download some files (zip and txt)
I'm using the latest indy snapshot (installed yesterday) and newest SSL libraries. When trying
I am trying to send an e-mail using gmail account (Delphi 7, Indy 10)
I am using indy 10 and i was wondering how can i implement a
I have been using Indy to transfers files via FTP for years now but
I have built a simple website monitoring application using Indy TIdhttp component. I want
I encoded a text in a TMemo using base64 encoding tools ( like Indy
I am using Delphi 2010 and Indy 10 that ships with it. The MemStream

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.