Embedded Web Server

Hi. I ordered the EMX development kit. It did not occur to me until after I ordered it that there was no indication that it has an embedded web server (that handles photos, etc). Is there one available, or do I need to write one myself?

Thank you.

There is sockets with UDP, TCP, HTTP, SSL, DNS, DHCP support. Basically, more than what you would soo on any small embedded systems.

Beyond that, you have to implement the work yourself…with help from this great community if you need it.

What are you trying to do? Host a little website with images from SD card and USB thumb drive for example? This can very easily on EMX

I’m just looking to make a nice looking web page for users to access to configure settings for my embedded project. In addition to the web page, on a different port, I would need to have a TCP server to receive commands. It looks like the EMX is capable of running both of these servers at the same time, correct?

Yes you can use two TCP ports.

It’s perfectly possible :slight_smile:
We did that, serving web pages from the SD card on tcp/80 while
sending other data on some other tcp/port (single network interface)

Currently the software we use to control our devices is written in WPF,
but can easily be ported to Silverlight, so we’re even considering putting the Silverlight app on the SD card so it’s always available :slight_smile:

The sky is the limit :slight_smile:

As for some code, it’s easy

You need to create a HttpListener and handle incoming requests.
Somewhere in your code you’d have something like:

private void StartHttpListener()
{
    server = new HttpListener("http", 80);
    server.Start();
    while (true)
        new HttpRequestHandler(server.GetContext());
}

Next you’d need to create a class (in this case the HttpRequestHandler)
that actually handles those requests:

internal class HttpRequestHandler
{
	public string CurrentText { get; set; }

	private HttpListenerContext context;

	public HttpRequestHandler(HttpListenerContext context)
	{
		this.context = context;
		var thread = new Thread(new ThreadStart(ProcessRequest));
		thread.Start();
	}

	private void ProcessRequest()
	{                        
		var requestedPath = context.Request.Url.OriginalString;
		
		//Now you can check the path and process it any way you want
		//might be performing some action or loading something from the SD
		//etc...             
	}
}

It’s not much, but I hope it gives you a start

You can use my Webserver class for that. I’m also creating a object to json convertor to use together with the webserver. Check it out at http://blog.fastload-media.be

Edit: find the project on fezzer. The blog has been removed.

Take a look at Microsoft’s example under

or

WOW! Thanks everyone!