Hi,
I know that i'm digging an old thread but I have the similar question and I must manually set the IP address (so no DHCP).
Is there any way to do it ?
Thanks.
Cédric
Hi Cédric:
var interfaces = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(); foreach (var networkInterface in interfaces) { Debug.Print(networkInterface.IsDhcpEnabled ? "Dhcp Enabled" : "Static Ip"); Debug.Print(networkInterface.IPAddress); if (networkInterface.IsDhcpEnabled) { networkInterface.EnableStaticIP("192.168.0.9", "255.255.255.0", "192.168.0.1"); } }
This prints out whether you're already Dhcp Enabled or Static, and if Dhcp it sets to static.
You'd probably want to be a little cleverer around releasing leases if you want to be friendly to your dhcp server, but otherwise the above works.
Regards
Andy