Board index » delphi » DNS-LookUp from DNS-Server

DNS-LookUp from DNS-Server

Hi newsgroup,

I asked a similar question before, but I still have problems with my
DNS-LookUp Procedure.

I want to write a fast DNS-LookUp procedure, because I need it for a
logfile-analysing-programm. I used GetHostByAddr in threads. The speed
was ok, but as I installed a lan, the speed decreased much.

So I want request the DNS directly from a dns-server, now.

Does anyone know servers which I'm allowed to traffic with my request
for free?
And can someone send me a (code)-example how to make this request?

Thank you for your answers,

Bye
  Steffen

 

Re:DNS-LookUp from DNS-Server


You could try this - it is the same as running ipconfig /all   ...

function GetDNS: string;
var stTemp, RPath: string;
   RegObject: TRegistry;
   lst:TStringList;
begin
   RPath := 'system\currentcontrolset\services\tcpip\parameters';
   RegObject := TRegistry.Create;
   lst:=TStringList.Create;
   stTemp:='';
   try
      with RegObject do
         begin
            RootKey := HKEY_LOCAL_MACHINE;
            if OpenKey(RPath, True) then
               begin
                  lst.CommaText:= ReadString('DHCPNameserver');
                  stTemp:=lst.strings [0];
               end;
         end;
   finally
      RegObject.CloseKey;
      RegObject.Free;
      lst.free;
   end;
   result:=stTemp;
end; (*  *)

Quote
Steffen Rendle wrote:

> Hi newsgroup,

> I asked a similar question before, but I still have problems with my
> DNS-LookUp Procedure.

> I want to write a fast DNS-LookUp procedure, because I need it for a
> logfile-analysing-programm. I used GetHostByAddr in threads. The speed
> was ok, but as I installed a lan, the speed decreased much.

> So I want request the DNS directly from a dns-server, now.

> Does anyone know servers which I'm allowed to traffic with my request
> for free?
> And can someone send me a (code)-example how to make this request?

> Thank you for your answers,

> Bye
>   Steffen

Re:DNS-LookUp from DNS-Server


"Kerry Neighbour" <"kneighbour"@REMOVE THISsimcomcity.com> wrote in message
news:8sj8ik$4142@bornews.borland.com...

Quote
> You could try this - it is the same as running ipconfig /all   ...

> function GetDNS: string;
> var stTemp, RPath: string;
>    RegObject: TRegistry;
>    lst:TStringList;
> begin
>    RPath := 'system\currentcontrolset\services\tcpip\parameters';
>    RegObject := TRegistry.Create;
>    lst:=TStringList.Create;
>    stTemp:='';
>    try
>       with RegObject do
>          begin
>             RootKey := HKEY_LOCAL_MACHINE;
>             if OpenKey(RPath, True) then
>                begin
>                   lst.CommaText:= ReadString('DHCPNameserver');

There is not such parameter in the registry of my computer (NT4 SP5).

--
Best Regards,
Vladimir Vassiliev
http://voldemarv.virtualave.net

Re:DNS-LookUp from DNS-Server


Ah well - it is just a W2K thing then...

But you should have something similar - run ipconfig /all, make a note
of the DNS server IP, then do a search for that in the registry. That
might find the appropriate key for NT4.
There isn't anything in Win98 either...we just checked...

If anyone knows how to do this....I would be glad to find out!

Quote
Vladimir Vassiliev wrote:

> "Kerry Neighbour" <"kneighbour"@REMOVE THISsimcomcity.com> wrote in message
> news:8sj8ik$4142@bornews.borland.com...
> > You could try this - it is the same as running ipconfig /all   ...

> > function GetDNS: string;
> > var stTemp, RPath: string;
> >    RegObject: TRegistry;
> >    lst:TStringList;
> > begin
> >    RPath := 'system\currentcontrolset\services\tcpip\parameters';
> >    RegObject := TRegistry.Create;
> >    lst:=TStringList.Create;
> >    stTemp:='';
> >    try
> >       with RegObject do
> >          begin
> >             RootKey := HKEY_LOCAL_MACHINE;
> >             if OpenKey(RPath, True) then
> >                begin
> >                   lst.CommaText:= ReadString('DHCPNameserver');

> There is not such parameter in the registry of my computer (NT4 SP5).

> --
> Best Regards,
> Vladimir Vassiliev
> http://voldemarv.virtualave.net

Re:DNS-LookUp from DNS-Server


Yes the keyName is 'NameServer'. But it's statically defined. I don't know
will it be similar if the DNS server is defined by PPP.

On Win98 and Win2000 you can use functions from iphlpapi.dll.

Vladimir

"Kerry Neighbour" <"kneighbour"@REMOVE THISsimcomcity.com> wrote in message
news:8sjlc4$aft2@bornews.borland.com...

Quote
> Ah well - it is just a W2K thing then...

> But you should have something similar - run ipconfig /all, make a note
> of the DNS server IP, then do a search for that in the registry. That
> might find the appropriate key for NT4.

> There isn't anything in Win98 either...we just checked...

> If anyone knows how to do this....I would be glad to find out!

> Vladimir Vassiliev wrote:

> > "Kerry Neighbour" <"kneighbour"@REMOVE THISsimcomcity.com> wrote in
message
> > news:8sj8ik$4142@bornews.borland.com...
> > > You could try this - it is the same as running ipconfig /all   ...

> > > function GetDNS: string;
> > > var stTemp, RPath: string;
> > >    RegObject: TRegistry;
> > >    lst:TStringList;
> > > begin
> > >    RPath := 'system\currentcontrolset\services\tcpip\parameters';
> > >    RegObject := TRegistry.Create;
> > >    lst:=TStringList.Create;
> > >    stTemp:='';
> > >    try
> > >       with RegObject do
> > >          begin
> > >             RootKey := HKEY_LOCAL_MACHINE;
> > >             if OpenKey(RPath, True) then
> > >                begin
> > >                   lst.CommaText:= ReadString('DHCPNameserver');

> > There is not such parameter in the registry of my computer (NT4 SP5).

> > --
> > Best Regards,
> > Vladimir Vassiliev
> > http://voldemarv.virtualave.net

Re:DNS-LookUp from DNS-Server


Hi,

thank you for your answers.

Quote
> Yes the keyName is 'NameServer'. But it's statically defined. I don't know
> will it be similar if the DNS server is defined by PPP.

My registry doesn't contain any of those keys.

Quote
> On Win98 and Win2000 you can use functions from iphlpapi.dll.

Do you know where I can find a documentation of this library?

Bye
  Steffen

Re:DNS-LookUp from DNS-Server


Quote
"Steffen Rendle" <stef...@rendle.de> wrote in message

news:39EDA51A.C90D1D30@rendle.de...
Quote
> Hi,

> thank you for your answers.

> > Yes the keyName is 'NameServer'. But it's statically defined. I don't
know
> > will it be similar if the DNS server is defined by PPP.

> My registry doesn't contain any of those keys.

> > On Win98 and Win2000 you can use functions from iphlpapi.dll.

> Do you know where I can find a documentation of this library?

http://msdn.microsoft.com/library/psdk/rras/iphpport_7vz9.htm

If you are interested I can send you PAS translations of C headers.

WBR,
Vladimir

Re:DNS-LookUp from DNS-Server


Hi Vladimir,

Quote
> > Do you know where I can find a documentation of this library?
> http://msdn.microsoft.com/library/psdk/rras/iphpport_7vz9.htm

Thanks.

Quote
> If you are interested I can send you PAS translations of C headers.

Yes, please.

Bye
  Steffen

Re:DNS-LookUp from DNS-Server


And here too, if that is not too much trouble...<g>
Quote
Steffen Rendle wrote:

> Hi Vladimir,

> > > Do you know where I can find a documentation of this library?
> > http://msdn.microsoft.com/library/psdk/rras/iphpport_7vz9.htm

> Thanks.

> > If you are interested I can send you PAS translations of C headers.

> Yes, please.

> Bye
>   Steffen

Re:DNS-LookUp from DNS-Server


Why don't you run "ipconfig /all" and parse the result?
Link to unit to capture console program output
http://www.ectsoftware.com/ConsoleUtil.zip

Erik Turner
Indialantic, Florida

"Kerry Neighbour" <"kneighbour"@REMOVE THISsimcomcity.com> wrote in message
news:8sj8ik$4142@bornews.borland.com...
You could try this - it is the same as running ipconfig /all   ...

[ code snipped ]

Other Threads