473,543 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

When I do something like this

For Each ip As System.Net.IPAd dress _
In System.Net.Dns. GetHostByName(s trDomain).Addre ssList
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 1644
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinM gmts:")
objs = WMI.InstancesOf ("Win32_Network AdapterConfigur ation")
For Each obj In objs
MsgBox(obj.DHCP Server.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******** ******@TK2MSFTN GP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAd dress _
In System.Net.Dns. GetHostByName(s trDomain).Addre ssList
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 DNSServerSearch Order instead of DHCPServer

"Terry Olsen" <to******@hotma il.com> wrote in message
news:ep******** ******@TK2MSFTN GP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinM gmts:")
objs = WMI.InstancesOf ("Win32_Network AdapterConfigur ation")
For Each obj In objs
MsgBox(obj.DHCP Server.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******** ******@TK2MSFTN GP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAd dress _
In System.Net.Dns. GetHostByName(s trDomain).Addre ssList
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******@hotma il.com> wrote in message
news:ep******** ******@TK2MSFTN GP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinM gmts:")
objs = WMI.InstancesOf ("Win32_Network AdapterConfigur ation")
For Each obj In objs
MsgBox(obj.DHCP Server.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******** ******@TK2MSFTN GP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAd dress _
In System.Net.Dns. GetHostByName(s trDomain).Addre ssList
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******@hotma il.com> wrote in message
news:Ox******** ******@TK2MSFTN GP14.phx.gbl...
oops. I think you need DNSServerSearch Order instead of DHCPServer

"Terry Olsen" <to******@hotma il.com> wrote in message
news:ep******** ******@TK2MSFTN GP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinM gmts:")
objs = WMI.InstancesOf ("Win32_Network AdapterConfigur ation")
For Each obj In objs
MsgBox(obj.DHCP Server.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******** ******@TK2MSFTN GP10.phx.gbl...
When I do something like this

For Each ip As System.Net.IPAd dress _
In System.Net.Dns. GetHostByName(s trDomain).Addre ssList
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.DHCP Server.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******** ******@TK2MSFTN GP09.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******@hotma il.com> wrote in message
news:ep******** ******@TK2MSFTN GP14.phx.gbl...
This works...
Dim objs As Object
Dim obj As Object
Dim WMI As Object
WMI = GetObject("WinM gmts:")
objs = WMI.InstancesOf ("Win32_Network AdapterConfigur ation")
For Each obj In objs
MsgBox(obj.DHCP Server.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******** ******@TK2MSFTN GP10.phx.gbl...
> When I do something like this
>
> For Each ip As System.Net.IPAd dress _
> In System.Net.Dns. GetHostByName(s trDomain).Addre ssList
> 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
1892
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
1764
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 visible. Help me please!! Thanks. Mark
5
1598
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 ftp://ftp.software.ibm.com/ps/products/db2/fixes/english-us/db2sunv8/fixpak/FP8_U800664/FP5_U800664.tar wget ftp://ftp.software.ibm.com/ps/products/db2/fixes/english-us/db2sunv8/fixpak/FP8_U800664/FP5_U800664.tar --13:18:25--...
1
436
by: HB2 | last post by:
Is it possible to obtain the IP address of my desktop using a Visual Basic command?
5
2053
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 has a method ProcessRequest()
1
1562
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
41057
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
2468
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 value of one of the parameters that were passed to the method. Is this possible? Even if I have to use PInvoke to do so? I can currently find...
2
1438
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 recursively after every 2 secs. The web service accepts that accout number as an input parameter, invokes a stored procedure and returns the current...
0
1922
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 Management Objects SQL Server 2008 Native Client SQL Server 2008 Setup Support File (English) SQL Server Compact 3.5 SP1 Design Tools English SQL...
0
7411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7594
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7354
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7693
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4898
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3394
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3394
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1824
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.