sagett

I want to list all IP address on my network. My network have 7 host. How can I do this. I try theese methods in Form1_Load() event but theese methods listed my IP address only.

string myHost = System.Net.Dns.GetHostName();

System.Net.IPHostEntry myIPs = System.Net.Dns.GetHostEntry(myHost);

foreach(System.Net.IPAddress myIP in myIPs.AddressList)

{

listBox1.Items.Add(myIP);

}

and the other one

using System.Management;

ManagementObjectSearcher objSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");

ManagementObjectCollection objCollection = objSearcher.Get();

foreach (ManagementObject obj in objCollection)

{
string[] AddressList = (string[])obj["IPAddress"];

foreach (string Address in AddressList)
{
listBox1.Items.Add(myIP);

}

}




Re: .NET Compact Framework How can I get the all IP address on my network

Ilya Tumanov

See this.