I’m attempting to do some network programming with the Hydra and ENC28 Ethernet module. I could not get DHCP to function so I’m utilizing a static IP. Still, I’m unable to use the WebClient and WebServer APIs successfully. I’m testing the WebClient with the following code:
HttpRequest req = WebClient.GetFromWeb("http://www.google.com/");
req.ResponseReceived += new HttpRequest.ResponseHandler(req_ResponseReceived);
req.SendRequest();
This always results in a timeout and the event handler is never called.
I’m testing WebServer with the following code:
WebEvent evt = WebServer.SetupWebEvent("hello");
evt.WebEventReceived += new WebEvent.ReceivedWebEventHandler(evt_WebEventReceived);
WebServer.StartLocalServer("10.0.0.2", 80);
I’m able to view the default page at http://10.0.0.2/ with my browser but when I attempt to navigate to http://10.0.0.2/hello the page never loads and the event handler is never called.
Could this be a problem with my setup or do the drivers need more work? Is anybody using the functionality successfully?
I have attached a screenshot of my network settings.
Hi, I don’t have a Hydra or ENC28 module, but is it supposed to operate functionally the same as the J11D one that came with Spider Starter Kit? There’s a downloads section for this Getting Started book: http://www.gadgeteerbook.com/home - the HelloWebServer example has code that worked for me with Spider & J11D, so you could compare with that to convince yourself your code is sound. I see a couple of differences in that example code and your snippet, but I don’t know how important those differences really are - HelloWebServer had the line WebServer.StartLocalWebserver before the lines setting up the WebEvent and ReceivedWebEventHandled, and these lines were themselves all in an event handler for ethernet.NetworkUp which was setup in ProgramStarted. If the example doesn’t work out of the box unaltered for Hydra+ENC28, it did with Spider+J11D.
I can’t use those examples as-is because the ENC28 module is not yet available in the designer. Still, I assume that if I was doing something wrong in the code I would get a more specific exception rather than the connection just timing out. I have tried several variations on the code I posted and still get the same issues. I know the ENC28 drivers still have some issues, but I was wondering if anyone was using them successfully or has found workarounds to any of these problems.
Did you load the Ethernet version of the firmware? Also, it is best to start a new thread as much changed in the past 5 months, since this thread was created.
[quote]Have you found any solution to your inital problem, Is615?[/quote]I was never able to resolve the issues. The consensus at the time seemed to be that the ENC28 driver from GHI needed some more work, see the other thread: http://www.tinyclr.com/forum/topic?id=7060. I’m not sure if they have released a new version since then.