NETMF Web Server

I am trying to get a basic web server running on my Raptor that can serve pages and react to the user pushing a button on the page.

I have the WebServer running, but as far as I can tell all it can do is serve static pages and all the examples of using it I have found are extremely simple: simple decode a couple of different pages and send something back.

So I thought I would go right down to the socket level and really see what was going on.

However the Socket Server example given in the 4.3 release does not work since

using Socket = System.Net.Sockets.Socket;

does not work.

I have not been able to figure out what to use to get at the socket (IP socket, not Gadgeteer socket, very confusing and hard to search) access.

Can anyone point me in the right direction or have some sample code?


So I found the reference needed for Sockets: System.

However using the WebServer class I still can’t figure out how to retrieve the data sent by my HTML form.

@ Duncan, welcome.

Is your form sending a GET or a POST request to your server?

If a GET, you should see the data as parameters at the end of the URL.

If POST, you don’t see them on the URL.

What does the request you are seeing from the browser back to your server look like?


I use a Get.

The following is the test html I am using:

if I type something in to the text box (in this case ABCD) and click the button the url sent to my device is as I want it:

This triggers my goodbye web event, but I don’t know how to get the Text1=ABCD.

In the WebEventReceived event, the path is “goodbye”, the method = 1 (i,e,get) and the responder has stuff for sending the response. Don’t know why it would ever be in the response any way, but I have looked through it for my data and can’t find it.

So that is my problem. How using the Webserver can I get the query part of the URL?

So it is in the respoder in a Dicrionary called UrlParameters.

Mystery solved. But only by looking at the source code.


Could this discussion be of any help?

Yes that post is critical to get the WebServer working at all. I did as suggested and got the server to decode and process my requests. My issue was getting the query part of the URL to my app so that I know the user’s input.

Path now looks clear to a fully functional web server!

Very good. That post was useful for me as well.

@ Duncan - Have you considered to use HttpListener to listen http incoming requests ? That’s very powerful and you can work on urls as you want.

Yes, I have about 10 Cerbuinos deployed at work that use a listener in a separate thread. It does work well. I have not updated that code to 4.3 yet.