473,395 Members | 1,696 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.

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

When I do something like this

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
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.
Nov 21 '05 #1
6 1637
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinMgmts:")
objs = WMI.InstancesOf("Win32_NetworkAdapterConfiguration ")
For Each obj In objs
MsgBox(obj.DHCPServer.ToString)
Next
End Sub

To see all the different things you can do, look at this link...

http://www.activexperts.com/activmon...rConfiguration
"vbsearch" <dfgfdg> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
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.

Nov 21 '05 #2
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
Nov 21 '05 #3
oops. I think you need DNSServerSearchOrder instead of DHCPServer

"Terry Olsen" <to******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinMgmts:")
objs = WMI.InstancesOf("Win32_NetworkAdapterConfiguration ")
For Each obj In objs
MsgBox(obj.DHCPServer.ToString)
Next
End Sub

To see all the different things you can do, look at this link...

http://www.activexperts.com/activmon...rConfiguration
"vbsearch" <dfgfdg> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
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.


Nov 21 '05 #4
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?

"Terry Olsen" <to******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinMgmts:")
objs = WMI.InstancesOf("Win32_NetworkAdapterConfiguration ")
For Each obj In objs
MsgBox(obj.DHCPServer.ToString)
Next
End Sub

To see all the different things you can do, look at this link...

http://www.activexperts.com/activmon...rConfiguration

"vbsearch" <dfgfdg> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
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.



Nov 21 '05 #5
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.


"Terry Olsen" <to******@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP14.phx.gbl...
oops. I think you need DNSServerSearchOrder instead of DHCPServer

"Terry Olsen" <to******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinMgmts:")
objs = WMI.InstancesOf("Win32_NetworkAdapterConfiguration ")
For Each obj In objs
MsgBox(obj.DHCPServer.ToString)
Next
End Sub

To see all the different things you can do, look at this link...

http://www.activexperts.com/activmon...rConfiguration

"vbsearch" <dfgfdg> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
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.




Nov 21 '05 #6
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:
For Each obj In objs
MsgBox(obj.DHCPServer.ToString)
Next

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.
"vbsearch" <dfgfdg> wrote in message
news:Od**************@TK2MSFTNGP09.phx.gbl...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?

"Terry Olsen" <to******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinMgmts:")
objs = WMI.InstancesOf("Win32_NetworkAdapterConfiguration ")
For Each obj In objs
MsgBox(obj.DHCPServer.ToString)
Next
End Sub

To see all the different things you can do, look at this link...

http://www.activexperts.com/activmon...rConfiguration


"vbsearch" <dfgfdg> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
> When I do something like this
>
> For Each ip As System.Net.IPAddress _
> In System.Net.Dns.GetHostByName(strDomain).AddressLis t
> 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.


Nov 21 '05 #7

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

Similar topics

2
by: Jan | last post by:
Hi, I want to obtain the source code of a php file on a public server. Is there any way to do so? and how to? thx in advance
2
by: Marco | last post by:
I need to obtain the domain from server side code. Request.Servervariables("URL") doesn't work well... it miss the domain name. I tried to use the WScript.NetWork object but the domain is not...
5
by: Mary Lei | last post by:
I have problems connecting to ftp server to obtain the solaris fixpak to upgrade to DB2 8.2.1 ...
1
by: HB2 | last post by:
Is it possible to obtain the IP address of my desktop using a Visual Basic command?
5
by: OneFang | last post by:
Hi I hope I make sense here. I want to be able to obtain the name of the method that calls a method within my class. So If I have my class that has a method LogInfo() And my client code...
1
by: Yaro | last post by:
Hi How obtain server (machine name) with db2 8.1.5 ? I need get this name in select statement: select (something) from sysibm.sysdummy1 Would be nice also obtain fixpack level.
6
by: Maguila007 | last post by:
Hi Is there any way to obtain the name of the function, inside the function which was called. Ex: function something() { alert( "The name of the function you invoke is " ......should
2
by: ME | last post by:
How would one obtain the parameter VALUES of a method that has already run? I can find the method using the StackTrace and StackFrame classes but once I find the method I would like to obtain the...
2
by: mm3178 | last post by:
Hello Mates, My case is slightly complicated....please help me In order to obtain real time current balance of an account, I have built a c# windows service that invokes a c# web service...
0
by: BobLewiston | last post by:
I did a full installation of SQL Server 2008 Express. Looking at Add / Remove Programs, I see the following pertinent programs installed: SQL Server 2008 SQL Server 2008 Browser SQL Server 2008...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.