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");
}
}