Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the current DNS server?

Tags:

I'm using Delphi and need to get the current Windows DNS server IP address so I can do a lookup. What function should I call to find it? The only solution I have right now does an ipconfig/all to get it, which is horrible.

like image 770
mj2008 Avatar asked Sep 15 '08 10:09

mj2008


2 Answers

Found a nice one using the function GetNetworkParams().Seems to work quite good. You can find it here: http://www.swissdelphicenter.ch/torry/showcode.php?id=2452

like image 150
DeeCee Avatar answered Sep 30 '22 18:09

DeeCee


Do you really need to know what is DNS server to do a lookup?

Here is a solution how to get a IP address using 2 functions: GetHostName and GetHostByName. I assume the GetHostByName function does the lookup you need for you, or am I wrong?

like image 39
kender Avatar answered Sep 30 '22 19:09

kender