Need Help ( I am doing something wrong - but what?)

So I am trying like crazy to get data to flow from the ethernet - but everything
I try is not working.

I am getting the IP address OK (DHCP or static - it all works).
I am setting up the call-back event handler.
I am sending the request.
But my event handler is never called.

I must be doing something basic wrong here - but I am looking too closely. The attached
file is the simplest code to illustrate what I am trying – and what doesnt work. In the attached
file - I load “”. The event handler should be called - and never is.

I have two spider boards - so I am fairly sure the hardware is OK. FW is up to date.

Anyone see where I have gone wrong?




using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerAppTest
public partial class Program

    // This method is run when the mainboard is powered up or reset.   
    void ProgramStarted()
        Debug.Print("Program Started");
        led.GreenBlueSwapped = true;
        ethernet.NetworkUp += OnNetworkUp;
        ethernet.NetworkDown += OnNetworkDown;

        ethernet.UseStaticIP("", "", "");

        while (true) {
            if (ethernet.IsNetworkUp)
                WebClient.GetFromWeb("").ResponseReceived += new HttpRequest.ResponseHandler(request_ResponseReceived);



    void request_ResponseReceived(HttpRequest request, HttpResponse response) {


void OnNetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
Debug.Print(“Network up.”);

    void OnNetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        Debug.Print("Network dn.");



No need for the while(true)
get rid of it… you are blocking the events…

It’s spending its time in sleep(10000).
Its just a main loop.

Are you saying no events while sleeping?


You need to move that code to another thread or use a timer if you want … DO NOT Put while statement in the Program Starter or you will BLOCK the whole application…
Gadgeteer needs to exit From Program Stater to execute the events…

BTW when you exit Program Stater your application stays running, it is different from standard netmf applications.

please read here:



Thanks VM.


Anytime and welcome to Gadgeteer World :wink: