C# Change IP Address
-
How can I change IP address using with C# on Windows CE OS. I use .NET Compact Framework (3.5), how can I change IP address? And SubnetMask, DefaultGateway, DNS. If you know openNETCF example, please write link, I found same class but I can't use it, because this class is privite. Thanks...
-
How can I change IP address using with C# on Windows CE OS. I use .NET Compact Framework (3.5), how can I change IP address? And SubnetMask, DefaultGateway, DNS. If you know openNETCF example, please write link, I found same class but I can't use it, because this class is privite. Thanks...
Hi, have you found the solution to your question? I am currently searching for a solution myself. I am using this code on a Windows Mobile 6 device, but it doesn't seem to set the IP to the hardcoded one. Instead, it stays 0.0.0.0. Maybe you or someone else can figure this out. Cheers!
private NetworkInterface wireless_interface; System.Net.IPAddress ip = System.Net.IPAddress.Parse("192.168.16.1"); if (wireless_interface == null) return; wireless_interface.CurrentIpAddress = ip; wireless_interface.Bind();
-
Hi, have you found the solution to your question? I am currently searching for a solution myself. I am using this code on a Windows Mobile 6 device, but it doesn't seem to set the IP to the hardcoded one. Instead, it stays 0.0.0.0. Maybe you or someone else can figure this out. Cheers!
private NetworkInterface wireless_interface; System.Net.IPAddress ip = System.Net.IPAddress.Parse("192.168.16.1"); if (wireless_interface == null) return; wireless_interface.CurrentIpAddress = ip; wireless_interface.Bind();
Hi, At first sight I see a major issue in the code you provided :
private NetworkInterface wireless_interface;
...
if (wireless_interface == null)
return;Since you never assign the wireless_interface variable to an instance of
NetworkInterface
, it will always benull
; thus your method will always return before reaching thewireless_interface.CurrentIpAddress = ip;
line.