-
November 25th, 2008, 03:09 AM
#1
Scan NIC for IPs
When I check my system for present NICS ...
Code:
cbNics.Items.Clear();
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
if (nics == null || nics.Length < 1)
{
cbNics.Items.Add("-- No network interfaces found --");
}
foreach (NetworkInterface adapter in nics)
{
cbNics.Items.Add(adapter.Description);
}
I would then like to select a specific NIC and scan the attached network for all present IP addresses.
Any suggestion how to do this ?
-
November 25th, 2008, 04:02 AM
#2
Re: Scan NIC for IPs
Last edited by MNovy; November 25th, 2008 at 04:06 AM.
-
November 25th, 2008, 05:45 AM
#3
Re: Scan NIC for IPs
Ok, I know how to select a specific nic from the returned collection !
My question actually is , starting from this NetworkInterface object to scan the attached network for IP addresses. I want to find out what devices are hooked up to the nic.
-
November 25th, 2008, 09:49 AM
#4
Re: Scan NIC for IPs
There is no fail safe method to detect all devices attached to a network. Still, you can use the IP address and netmask of the NIC to find out what the range of possible IP addresses is for the network that NIC is connected to. Then for each individual NIC in that range you can use ARP to find out if there is an active NIC on the network.
You will of course not receive any answer from devices that are currently off (but still may have a fixed IP address asigned to them).
Please note - one NIC may have multiple ranges of addresses for different subnets it is connected to.
In any case, this is not something I have ever needed to do, but this is probably how I would go about it..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|