473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

[howto] get the nameserver name?

In my code I have to query the local dns server for some data. however, I
have no idea how to get the name of the local DNS server.

could anyone point me the right direction?
thanks in advance,

Wiktor Zychla
Nov 15 '05 #1
4 2569
Wiktor Zychla wrote:
In my code I have to query the local dns server for some data. however, I
have no idea how to get the name of the local DNS server.

could anyone point me the right direction?
thanks in advance,

Wiktor Zychla


Would System.Net.Dns class help you?

--
Girish Bharadwaj

Nov 15 '05 #2
> Would System.Net.Dns class help you?

If you can help to show me the proper method or property of this class, I
would be grateful. I make a heavy use of Dns class and didn't find any way
to get the nameserver name.
Nov 15 '05 #3
Wiktor Zychla wrote:
Would System.Net.Dns class help you?

If you can help to show me the proper method or property of this class, I
would be grateful. I make a heavy use of Dns class and didn't find any way
to get the nameserver name.

Oh.. Sorry, I was thinking you wanted the services of Dns and not the
name. If you have enough privileges, you can check the
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servi ces\Tcpip\Parameters"'s
"NameServer" string.

--
Girish Bharadwaj

Nov 15 '05 #4
"Wiktor Zychla" <ie****@microsoft.com.no.spam> wrote in message news:<uc**************@TK2MSFTNGP09.phx.gbl>...
Would System.Net.Dns class help you?


If you can help to show me the proper method or property of this class, I
would be grateful. I make a heavy use of Dns class and didn't find any way
to get the nameserver name.

You can use the System.Management methods:

class GetDNS
{
public static void Main()
{
ManagementObjectSearcher mos = new ManagementObjectSearcher(
"SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection moc = mos.Get();
foreach(ManagementObject mo in moc)
{
Console.WriteLine("Network Card: {0}", mo["Description"]);
string[] hosts = (string[])mo["DNSServerSearchOrder"];
foreach(string host in hosts)
Console.WriteLine(" DNS host: {0}",host);
}
}
}

Hope this helps some.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MAILER-DAEMON | last post by:
--------Message not delivered to the following addresses: shreeve@uci.edu --------Error Detail (phquery V3.0): ---- shreeve@uci.edu Does not exist, and no people with that name or...
4
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or...
4
by: Josef Sachs | last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere? I've found the following (dead) links on various Web pages: http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html...
5
by: Wilhelm Pieper | last post by:
Hello, HowTo: catch name/value pairs from request.form? My viewstate shows: "__VIEWSTATE=..&111=5.." I want to get this pairs of IDs/names and values . But because the DropDownList ist...
8
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do...
7
by: dmitrey | last post by:
hi all, can anyone explain howto get function from module, known by string names? I.e. something like def myfunc(module_string1, func_string2, *args): eval('from ' + module_string1 + 'import...
1
by: Magnus R | last post by:
I am using the System.Net namespace to do DNS lookups of a host and return their IP address. However I haven't figured out how to use the namespace to take a domain name and find the responsible...
0
by: Chuckk Hubbard | last post by:
The docs say to try to discover the URI on my own if this happens. Could I get a hand doing that? This isn't just something I want to solve on my machine, e.g. by changing my network setup or what...
0
by: Chuckk Hubbard | last post by:
OK, I think I have it. The Manual says to start a Name Server "using the ns command", and I figured out that means using the pyro-ns script. On Mon, Nov 10, 2008 at 10:49 AM, Chuckk Hubbard...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.