How get subnet mask 
Author Message
 How get subnet mask

There is a method to retrive the subnet mask of
the host that running the application?

I see the namespace System.Net, but i not find
anything.

Thank.

Hello everyone.



Sun, 05 Jun 2005 15:57:39 GMT  
 How get subnet mask
Hi Alex,

Try to use WMI. For example, in C#:
                        ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT *
FROM Win32_NetworkAdapterConfiguration");
                        ManagementObjectCollection queryCollection = query.Get();
                        string[] ipadds = null;
                        string[] ipsubnets = null;
                        foreach (ManagementObject mo in queryCollection)
                        {
                                if (true == Convert.ToBoolean(mo["IPEnabled"]))
                                {
                                        ipadds = (string[])mo["IPAddress"];
                                        foreach (string s in ipadds)
                                                Console.WriteLine(s);
                                        ipsubnets = (string[])mo["IPSubnet"];
                                        foreach (string t in ipsubnets)
                                                Console.WriteLine(t);
                                }
                        }

Here is a related article:
http://radio.weblogs.com/0110109/stories/2002/07/18/enumeratingNetwor...
rs.html

This posting is provided "AS IS" with no warranties, and confers no rights.

Regards,

Bill Cheng
Microsoft Support Engineer
--------------------

| Subject: How get subnet mask
| Date: Wed, 18 Dec 2002 08:57:39 +0100
| Lines: 11
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: 213.82.50.130
| Path: cpmsftngxa06!TK2MSFTNGP08!TK2MSFTNGP09
| Xref: cpmsftngxa06 microsoft.public.dotnet.languages.vb:80974
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| There is a method to retrive the subnet mask of
| the host that running the application?
|
| I see the namespace System.Net, but i not find
| anything.
|
| Thank.
|
| Hello everyone.
|
|
|



Fri, 10 Jun 2005 00:26:27 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting the subnet mask

2. Getting IP address, subnet mask and gateway

3. Getting the Subnet Mask in VB

4. How to change Subnet mask with NetSh?

5. Display DNS, Subnet Mask and Default Gateway

6. Subnet Mask?

7. subnet mask

8. Subnet Mask?

9. Network Subnet mask?

10. Network Subnet mask?

11. Subnet Mask

12. Subnet Mask?

 

 
Powered by phpBB® Forum Software