My Netduino 3 Wifi reliably connects to the Wireless Access Point in my office, then waits for an IP address and starts making http requests.
If I pull the LAN cable out of the back of the WAP the requests fail as expected
HTTP Status:200 : OK
HTTP Status:200 : OK
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
...
Then when I plug the cable back in, the HTTP requests start working again
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
HTTP Status:200 : OK
HTTP Status:200 : OK
...
So far so good, but if I power down the WAP the requests fail as expected and the WLAN connectivity LED on the N3 goes yellow.
HTTP Status:200 : OK
HTTP Status:200 : OK
HTTP Status:200 : OK
NetworkChange_NetworkAvailabilityChanged False
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
...
If I power the WAP back up, after a while the WLAN connectivity LED on the N3 goes Green. There is a network connectivity change notification but when the next HTTP request is initiated the device hangs
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
NetworkChange_NetworkAvailabilityChanged True
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
I grabbed the IP stack source and re-compiled my application
After several restarts I found that the application is hanging on the first call to
var response = (HttpWebResponse)request.GetResponse())
after the NetworkAvailabilityChanged notification indicates the network is back
Debugging down in the stack the lockup appears to be in
private InputNetworkStreamWrapper EstablishConnection(Uri proxyServer, Uri targetServer)
around line 1366 where it calls
hostEntry = Dns.GetHostEntry(proxyServer.Host);
The debugger complains that the code & binary don't match when I go further in
I noticed that when I put this line in
Debug.Print("IPAddress " + NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);
Just before the
using (HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.bing.com"))
The code then stopped in a similar way on the first call after the network connectivity restored notification
My Netduino 3 Wifi reliably connects to the Wireless Access Point in my office, then waits for an IP address and starts making http requests.
If I pull the LAN cable out of the back of the WAP the requests fail as expected
HTTP Status:200 : OK HTTP Status:200 : OK A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100 A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll ...
Then when I plug the cable back in, the HTTP requests start working again
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100 A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
HTTP Status:200 : OK HTTP Status:200 : OK ...
So far so good, but if I power down the WAP the requests fail as expected and the WLAN connectivity LED on the N3 goes yellow.
HTTP Status:200 : OK HTTP Status:200 : OK HTTP Status:200 : OK NetworkChange_NetworkAvailabilityChanged False A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100 A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll ...
If I power the WAP back up, after a while the WLAN connectivity LED on the N3 goes Green. There is a network connectivity change notification but when the next HTTP request is initiated the device hangs
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100 A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll NetworkChange_NetworkAvailabilityChanged True
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Netduino.IP.LinkLayers.CC3100 A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll
I grabbed the IP stack source and re-compiled my application
After several restarts I found that the application is hanging on the first call to
var response = (HttpWebResponse)request.GetResponse())
after the NetworkAvailabilityChanged notification indicates the network is back
Debugging down in the stack the lockup appears to be in
private InputNetworkStreamWrapper EstablishConnection(Uri proxyServer, Uri targetServer)
around line 1366 where it calls
hostEntry = Dns.GetHostEntry(proxyServer.Host);
The debugger complains that the code & binary don't match when I go further in
I noticed that when I put this line in Debug.Print("IPAddress " + NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);
Just before the
using (HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.bing.com"))
The code then stopped in a similar way on the first call after the network connectivity restored notification
For sample code and more info see http://forums.netduino.com/index.php?/topic/12240-netduino-3-wifi-connectivity-failure-mode-handling/