public static void WaitForIPAddress() { byte[] MAC = { 0x5C, 0x86, 0x4A, 0x00, 0xF2, 0x15 }; NetworkInterface ni; NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp(); NetworkInterface.GetAllNetworkInterfaces()[0].PhysicalAddress = MAC; while (true) { ni = NetworkInterface.GetAllNetworkInterfaces()[0]; if (ni.IPAddress != "0.0.0.0") break; Debug.Print("Waiting for an IP Address..."); Thread.Sleep(1000); } } }
I have a Netduino plus 2, running netmf 4.3.1
I can't get an ip address. When I look at the network interface it tells me my dns ip address, but that number is actually my gateway address? My IP address is always 0.0.0.0.
I have read other posts, and am using the suggested code. Any help would be great.
Thanks.
Terrence