WebEventReceived events don't fire on the Gadgeteer Webserver object

Hi,

I’m testing the Gadgeteer.Networking.WebServer class in the 4.3 SDK but get no reaction when surfing to the IP number of the gadgeteer board.
I use the underneath code with breakpoint in each of the OnWebEventReceived event methods but none of the break points fire. What looks strange to me is that the Network Interface object with the DHCP-offered IP number is in location 1 of the allIf variable instead of in the 0 position where I would expect it.

    public partial class Program
    {
        private static EthernetENC28J60 netif;

        void ProgramStarted()
        {

            // FEZ Cerberus Socket and Pins assigments
            var socket = GT.Socket.GetSocket(1, true, null, null);
            var pinINT = socket.CpuPins[3];
            var pinRESET = socket.CpuPins[4];
            var pinSPI_CS = socket.CpuPins[6];

            netif = new EthernetENC28J60(SPI.SPI_module.SPI1, pinSPI_CS, pinINT, pinRESET); 
            netif.Open();
            netif.EnableDhcp();
            while (netif.NetworkInterface.IPAddress == "0.0.0.0")
            {
                Debug.Print("Waiting for DHCP");
                Thread.Sleep(250);
            }

            Debug.Print("Network IPAddress : " + netif.NetworkInterface.IPAddress);
            var allIf = NetworkInterface.GetAllNetworkInterfaces();
            WebServer.SetupWebEvent("hello").WebEventReceived += OnWebEventReceived;
            WebServer.DefaultEvent.WebEventReceived += DefaultEventOnWebEventReceived;
            WebServer.StartLocalServer(netif.IPAddress, 80);
        }

        private void DefaultEventOnWebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
        {
            throw new NotImplementedException();
        }

        private void OnWebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
        {
            responder.Respond("Hello");
        }
    }

This link explains the problem
https://gadgeteer.codeplex.com/workitem/1861

This thread might help.
https://www.ghielectronics.com/community/forum/topic?id=16330

You need to modify the Webserver Responder.cs source code.

From


  protected byte[] ReceivedListToByteArray(ArrayList receivedList, int size)
        {
                [...]
                while (j < data.Length)
                {
                    result[lastIndex + i] = data[j];
                    j++;

                }
                [...]
        }
 

To


        protected byte[] ReceivedListToByteArray(ArrayList receivedList, int size)
        {
                [...]
                while (j < data.Length)
                {
                    result[lastIndex + j] = data[j];
                    j++;

                }
                [...]
        }
 

Thanks for this Thread…

I have the same issue with Version 4.3.5.0 (Gadgeteer SDK 4.3).

I have solved this about making a new build of the WebServer.dll.

Thx a lot.

Michael