2
Answers

Network Interface Configuration - C#

guillaume bourda

guillaume bourda

16y
5.5k
1

Hi Everybody,

I am a newbie in C# and .NET development and here is my problem:

I writing an application for a set of machines that will all be on the same LAN.

Upon booting a machine doesn’t have an IP and must configure its network interface using a list of [IP, Submask] couples - which means a machine can use any IP of the list, provided it is not already used.

 

For now my idea is to use the WMI class “Win32_NetworkAdapterConfiguration” with the functions “EnableStatic”. I take the first IP of the list, try to configure my network interface with it; check if there is a IP address conflict on the network, if yes try the next IP on the list…..etc.

 

The only problem is that I don’t know about to receive the system message that indicates there is a IP Address conflict.

 

Can someone help me with that?

Is there an easier way to check if an IP is already used when you don’t have any IP yourself (no ping possible) ?

 

 

I hope my question is clear enough J

Answers (2)