9 years, 7 months ago.

Simple HTTP/HTML server

I got myself a Wifi dipcortex with the intention that a simple HTTP server could run on it to be able to set for example the color of an RGB LED via a very simple HTML page. I have seen it done on Arduino, so surely there is something available on mbed, right?

Now the problem: I can't seem to find something like that. Now the mbed search isn't the greatest thing ever invented, but still. Plenty of clients for all kind of stuff, and websockets, but I want just a very simple html page to be served. You got this one: http://mbed.org/users/feb11/code/HTTP-Server/, and similar ones which do RPC over HTTP. It clearly shows the kind of page I want, but I don't want RPC (and that one is coded on top of EthernetInterface). I just want to be able to supply it a char pointer (or file object if needed) for the HTML page. This seems to have a static page option: http://mbed.org/users/screamer/code/HTTPServer/, but unless I am mistaken it also seems to be really built for the EthernetInterface (even though it isn't really included).

With small modifications this one actually properly works on a CC3000: http://mbed.org/users/hsgw/code/HTTPServer_echoback/, but sadly it doesn't do more than echo'ing the HTTP request.

Now with some tinkering I managed to let that code serve me a HTML page :D. However at the same time I cannot imagine I am the first one who likes to do something like this. So the question:

Is there somewhere a library which allows me to serve a simple, static HTML file that is on the bin file (so just a const char or something similar), and which is not hardcoded to use EthernetInterface/Wifly/something different than the CC3000? (Or at least not too hardcoded).

I am also interested in similar kind of thing. actually I was trying to copy the demo.cpp file of avnet wi-go module. it gives the web page which tell us about the room temp and pressure and u can control led as well. Can u please tell me how I can add some html stuff into my webserver ?? Because the one present in the Avnet Wi-go module has some limitations

posted by zain aftab 01 Sep 2014

4 Answers

9 years, 2 months ago.

The nweb code has been used as a template to create this library.
Beware, the library contains following copyright notice:
Individuals may use this application for evaluation or non-commercial purposes.

5 years, 10 months ago.

The HTML server is a vital role in creating a particular webpage in which HTML tags must be proper. In an iPhone, the users face server problems where they cannot access the internet from any browser. If you are an iPhone user and facing a server problem then you must visit https://applesupportnumber.net/apple-tv-support/ to solve your issues.

5 years ago.

Great post

9 years, 7 months ago.

Erik,

Are you aware of nweb? http://www.ibm.com/developerworks/systems/library/es-nweb/index.html It has a sockets interface, so in principle it should be usable with either Ethernet or CC3000. The documentation is very informative.

This forum article discusses several issues with nweb but also gives links to some other simple web servers: https://news.ycombinator.com/item?id=7505535

Hope this helps.

Thanks for the answer, and it certainly looks small looking at the source. However then I got to port it first to mbed, and I rather got something where I can just press the import button :).

posted by Erik - 01 Sep 2014