TidDNSResolver problem

Giganews Newsgroups
Subject: TidDNSResolver problem
Posted by:  Marc Tessier (tessier.ma…@videotron.ca)
Date: Wed, 24 Jan 2007

Hi

I am using Indy 10.1.16 on delphi 2005 and I am having some problem with the
idDNSResolver.

In my code, I am requesting a hostname IP address with a qtA record only.  I
am getting sometimes more then one hostname even if I have only one ip for
one hostname define in my DNS,  the records returned to me are the IP of the
nameserver (sometimes but not all the time) where the domain is located.
This is really strange that I get those IP. Even I get the same host and IP
multiple time in the queryresult.

any idea why this is happening.?

Note :    NewIP is extracted from a web page where I can know my current
public IP.

  IdDNSResolver1.AllowRecursiveQueries := true;

  IdDNSResolver1.ClearInternalQuery;

  IdDNSResolver1.QueryResult.Clear;

  IdDNSResolver1.WaitingTime := 10000;

  IdDNSResolver1.QueryType:=[qtA];

  IdDNSResolver1.Host := '24.200.241.37';

  IdDNSResolver1.Resolve(myhostname);

  SameIPbool := false;

  if IdDNSResolver1.QueryResult.Count = 0 then exit;

  for I :=0 to IdDNSResolver1.QueryResult.Count-1 do

  begin

    if IdDNSResolver1.QueryResult.Items[I].RecType = qta then

    begin

      with TARecord(IdDNSResolver1.QueryResult.Items[I]) do

      Begin

        OldIP := IPAddress;

        AName := Name;

      End;

      if NewIP = OldIP then

      Begin

        SameIPBool := true;

        break;

      End

      else

        SameIPbool := false;

    end;

    MessageDlg(myhostname+', '+AName+', '+NewIP+','+OldIP,mtCustom, [mbOK],
0);

  end;

  if not SameIPbool then

  Begin

    MessageDlg('Not Same...Old='+OldIP+', New='+NewIP,mtCustom, [mbOK], 0);

//
idhttp1.Get('https://www.nettica.com/Domain/Update.aspx?U=vcormier&PC=w2u0z001&FQDN=pickrunner.icwebpro.com&N='+NewIP);

  End;

Replies