I am getting started learning networking and am attempting to run the sample found here.
When I attempt to renew the DHCP address, it returns 0.0.0.0.
The following is the code I am testing.
if (Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces().Length < 1)
{
Debug.Print("No Active network interfaces.");
Thread.CurrentThread.Abort();
}
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface NI = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0];
if (NI.IsDhcpEnabled == false)
{
Debug.Print("Enabling DHCP.");
NI.EnableDhcp();
Debug.Print("DCHP - IP Address = " + NI.IPAddress + " ... Net Mask = " + NI.SubnetMask + " ... Gateway = " + NI.GatewayAddress);
}
else
{
Debug.Print("Renewing DHCP lease.");
NI.RenewDhcpLease();
Debug.Print("Renewed DCHP - IP Address = " + NI.IPAddress + " ... Net Mask = " + NI.SubnetMask + " ... Gateway = " + NI.GatewayAddress);
}
Results in the following:
DMX : Initializing network...
Renewing DHCP lease.
Renewed DCHP - IP Address = 0.0.0.0 ... Net Mask = 0.0.0.0 ... Gateway = 0.0.0.0
Any ideas? Thank you.