Main Site Documentation

Wot, no "NetworkUp"?


I’m trying to debug why the event NetworkUp never fires on the WiFi RS21 Gadgeteer module and I’ve distilled it down to a very simple code listing:

using Microsoft.SPOT;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace NetworkUpTest
    public partial class Program
        void ProgramStarted()
            wifi_RS21.NetworkUp += wifi_RS21_NetworkUp;
            wifi_RS21.NetworkDown += wifi_RS21_NetworkDown;
            var scans = wifi_RS21.Interface.Scan("LLOYDREGANS");
            if (scans != null && scans.Length > 0)
                Debug.Print("Joining " + scans[0].SSID);
                wifi_RS21.Interface.Join(scans[0], "**********");
            var giveUpWaitingForTheNetworkUpEvent = new GT.Timer(300000, GT.Timer.BehaviorType.RunOnce);
            giveUpWaitingForTheNetworkUpEvent.Tick += giveUpWaitingForTheNetworkUpEvent_Tick;

        void wifi_RS21_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)

        void wifi_RS21_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)

        void giveUpWaitingForTheNetworkUpEvent_Tick(GT.Timer timer)
            Debug.Print("Give up waiting for the NetworkUp event and try requesting the router homepage");
            var request = HttpHelper.CreateHttpGetRequest("");
            request.ResponseReceived += request_ResponseReceived;

        void request_ResponseReceived(HttpRequest sender, HttpResponse response)
            Debug.Print("Response received. response.Text.Length = " + response.Text.Length);

Here’s the listing from the output window when the program runs (minus the thread exited reports):

Given that the network is demonstrably up, why is “NetworkDown” the only event that fires from the WiFi RS21 module?


Check these posts:


Thanks Valentin, I’ll use


This stuff’s not that new now so it is odd that the exemplar code on the module page is wrong.


GHI is updating documentation, so we should see improvements in that area.