Main Site Documentation

Can't get very most basic web server to run on 4.3.4


This is probably painfully basic and I have looked in the documentation for guidance. However most of it is for 4.2 or 4.3.3 with significant differences for 4.3.4.

Raptor with an ENC28 module on Socket 1 (tried 3 as well) and a USB/Power module on Socket 8.

I can ping the board and it shows up in my router’s wired device list.

    public partial class Program

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
            Debug.Print("Program Started");

            ethernet.NetworkSettings.EnableStaticIP("", "", "");
            ethernet.NetworkInterface.EnableStaticDns(new String[] { "", "" });

            ethernet.NetworkUp += ethernet_NetworkUp;
            ethernet.NetworkDown += ethernet_NetworkDown;

            while (true)
                if (ethernet.IsNetworkUp) break;


            Gadgeteer.Networking.WebServer.StartLocalServer(ethernet.NetworkSettings.IPAddress, 80);

            Gadgeteer.Networking.WebEvent hello;
            hello = Gadgeteer.Networking.WebServer.SetupWebEvent("hello");
            hello.WebEventReceived += new WebEvent.ReceivedWebEventHandler(hello_WebEventReceived);

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

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

        void hello_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
            string content = "<html><body><h1>Hello World!!</h1></body></html>";
            byte[] bytes = new System.Text.UTF8Encoding().GetBytes(content);
            responder.Respond(bytes, "text/html");

When I run this I get the following in the output window:

Program Started
Web server started at
The thread ‘’ (0x3) has exited with code 0 (0x0).

Which seems fine. It then sits until I access from a browser:

http:\\hello or http:\ or any other combination of / and .

at which point in the output window I get:

#### Exception System.IndexOutOfRangeException - 0xa9000000 (6) ####
#### Message: 
#### Gadgeteer.Networking.Responder::FindHeaderSection [IP: 0034] ####
#### Gadgeteer.Networking.Responder::Parse [IP: 004b] ####
#### Gadgeteer.Networking.WebServerManager+Server::ProcessRequest [IP: 0090] ####

A first chance exception of type ‘System.IndexOutOfRangeException’ occurred in Gadgeteer.WebServer.dll
The thread ‘’ (0x6) has exited with code 0 (0x0).

So it appears that something gets through but is not being handled properly.

If I unplug the Ethernet and plug it in after the system boots, there is no difference except a whole bunch more “Waiting”


Looks like there is a bug in Gadgeteer’s Responder implementation. You can include Gadgeteer source code and see where that exception is thrown.


I would also suggest you try to not block the ProgramStarted with any form of while loop or waiting until your connection has stabilised. Set up handlers, and let it finish, so that the scheduler can get set up properly.


This thread explains the bug and the fix for it:

And this one explains in detail how to implement it :