Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N3 Wifi device stops responding if Wifi Access Point restarted #4

Open
KiwiBryn opened this issue Sep 21, 2015 · 0 comments
Open

N3 Wifi device stops responding if Wifi Access Point restarted #4

KiwiBryn opened this issue Sep 21, 2015 · 0 comments

Comments

@KiwiBryn
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant