How can I obtain the name/i.p. of my dns server ?

V

vbsearch

When I do something like this

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressList
MessageBox.Show(ip.ToString)
Next ip

would it be correct to assume that GetHostByName uses my local DNS
server to perform the translation. If so, is there a way to extract the
i.p.(or host name/address ) of this server, as I need to query it directly.

Tia.
 
C

Cor Ligthert

Terry,

Thanks nice link for WMI, I have them all, however in a program at the
moment that shows them object by object, so it is not easy to see them in
one time, but this link does.

Cor
 
V

vbsearch

I have just realised something:
If my ip is

a.b.c.d

and my computer is connected to the internet from an internal home
network, then the dns will always be

192.168.0.1 if network connection sharing is used
and
a.b.c.1 if real addresses are used.

Would that be the case (most of the time) ?



p.s.
thanks for your code, it works, I got a few blank message boxes
and 192.168.0.1. The only strange one was 255.255.255.255,
i think this one is irrelevant for tcp/ip, isn't it?
 
V

vbsearch

This one actually didn't (seem to) work.
I received a few empty strings plus one

System.Object[]

I don't know what it means.
 
T

Terry Olsen

If you have more than one network connection (say a dialup connection and a
LAN connection), you'll get a message box for each connection. Usually the
LAN connection is the first, so you only need the first one.

I think you can change this:
to:
MsgBox(objs.obj(0).DHCPServer.ToString) 'or (1) depending if 0 zero based.

Tho I haven't tried it. You'll have to play with it to get it right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top