2

Possible Duplicate:
Best way to programmatically configure network adapters in .NET

New to C# with a Java background. I'm looking for a way that allows me to add a second IP address to a NIC card.

I've implemented the solution here but could not get it too work. http://www.pinvoke.net/default.aspx/iphlpapi.addipaddress

I'd prefer not to use pinvoke and hoped there was a way to do this using c#, can anyone help ? thanks..

Community
  • 1
  • 1
user815809
  • 351
  • 5
  • 24
  • How did you do it in Java? (if you did) – Serguei Fedorov Jun 28 '12 at 15:25
  • 2
    This will probably help since it was already answered :) http://stackoverflow.com/questions/689230/best-way-to-programmatically-configure-network-adapters-in-net – Serguei Fedorov Jun 28 '12 at 15:26
  • @user1260028, would'nt be possible in Java but working on a C# module and have little experience. . – user815809 Jun 28 '12 at 16:23
  • @user1260028, would prefer to have more control. C++ allowed it, why would'nt c# – user815809 Jun 28 '12 at 16:24
  • C# is ALOT like Java. It is pretty much Microsofts answer to .NET for coders coming from Java. A lot of control is restricted including memory control (you cannot say, do memcpy). They pretty much work in the same way except for C# doesn't employ such a robust virtual machine (though they both have a garbage collection system). I've programmed in C# for a few years now and when it comes to hardware control it becomes tricky. – Serguei Fedorov Jun 28 '12 at 16:31
  • You can use System.Management assembly to do this. [This](http://stackoverflow.com/questions/209779/how-can-you-change-network-settings-ip-address-dns-wins-host-name-with-code) thread might be helpful. – Volodymyr Dombrovskyi Jun 28 '12 at 15:38
  • Yes, WMI support the ability to add an IP Address. You may get an array of current IPs, add your new one to it and then apply new array of IPs to NIC. – Volodymyr Dombrovskyi Jun 28 '12 at 18:21

0 Answers0