The first step is to go get an IP through the Dhcp and then tell me what it is so I can move onto the next bit, but all it does is repeat the waiting for IP
I connected and disconnected the cable several times but it just will not progress, it there something else I need to do?
Here is the code:
Private wSocket As System.Net.Sockets.Socket Private wPortNumber as Int32 = 4000 Sub Main() Microsoft.SPOT.Debug.Print("Starting System...") Dim Led As New Microsoft.SPOT.Hardware.OutputPort(SecretLabs.NETMF.Hardware.NetduinoPlus.Pins.ONBOARD_LED, False) Led.Write(False) Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0).EnableDhcp() Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0).ReleaseDhcpLease() Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0).RenewDhcpLease() 'this is a test to determine the IP address of the device Dim LocalIp As String = "0.0.0.0" 'Set the address to an invalid value LocalIp = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0).IPAddress 'attempt to get the ip address Do While LocalIp = "0.0.0.0" 'while it stays invalid keep looping Microsoft.SPOT.Debug.Print("Waiting for IP address...") 'write in the debug display that we are still waiting System.Threading.Thread.Sleep(1000) 'wait a second before trying again LocalIp = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(0).IPAddress 'attempt to get the ip address Loop Microsoft.SPOT.Debug.Print("The local IP address of your device is " & LocalIp) 'report the ip address to the debug log Led.Write(True) 'turn on the status led to indicate that the self setup is complete wSocket = New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp) wSocket.Bind(New System.Net.IPEndPoint(System.Net.IPAddress.Any, wPortNumber)) wSocket.Listen(Int32.MaxValue) 'call code to wait for connection End Sub
Here is what the debug produces:
A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.SPOT.Native.dll
Starting System...
Waiting for IP address...
Waiting for IP address...
Waiting for IP address...
Waiting for IP address...
Waiting for IP address...
Waiting for IP address...
Waiting for IP address...
Waiting for IP address... <== This repeats endlessly even after I connect the network cable
I would be greatful for any help