Embedded Web Server Overview
The first task in creating a small embedded web server is finding a small TCP/IP stack. Probably the most popular stack for small processors is the uIP stack written by Adam Dunkels. It has been ported to many processors such as the 8051 and AVR. Adam also wrote a larger, more full featured stack called lwIP.
The manufacturer of your CPU may have a TCP/IP stack. For example if you are using a PIC, Microchip offers a free TCP/IP stack.
The Web Server application sits on top of the TCP layer, and reads and writes data using the HTTP format. The uIP and lwIP stacks include a server.
In an embedded system it is usually important to be able to view settings and data, and also to be able to change those settings. To view them requires that the server send out a page with the current values, and those values may change each time the web client (browser) requests the page. Web pages like this are called "dynamic" meaning that the content changes in real time.
Changing settings is usually done by having the server serve a web page that includes a form. The user makes the desired settings on that form then clicks the submit button. This causes the data to be sent back to the server as an POST or GET message. The server then parses the message and takes the appropriate action. Javascript provides a simple way to customize controls on the form and add some intelligence.
Full featured web servers use a technique called CGI. This is where the server invokes a program, like a script or an executable, that goes out and gets the appropriate data then inserts it into the web page. In some cases the "web page" is actually an executable. Small servers may also have that capability, or may just mave a mechanism to substitute in the dynamic data when a tag or place holder is encountered within the page.