Ajit

Ajit

  • NA
  • 114
  • 2.4k

How to find all Network Interfaces for a given ip address.

Jul 2 2014 3:09 AM
How to find all Network Interfaces for a given ip address.

Right now,I am using below code to determine it but it is always giving it for local computer and I want to achieve it for given IP address.

NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{

IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
IPAddressCollection dnsServers = adapterProperties.DnsAddresses;
if (dnsServers.Count > 0)
{

Console.WriteLine("Adapter Id .... : " + adapter.Id);
Console.WriteLine("Adapter Description .... : " + adapter.Description);
Console.WriteLine("Adapter Name .... : " + adapter.Name);
Console.WriteLine("Network Interface Type .... : " + adapter.NetworkInterfaceType.ToString());
Console.WriteLine("Adapter Speed .... : " + adapter.Speed);
Console.WriteLine("OperationalStatus .... : " + adapter.OperationalStatus);
Console.WriteLine("Adapter SupportsMulticast .... : " + adapter.SupportsMulticast);

}
}

please suggest..........

Answers (1)