lwIP Wiki
Register
Advertisement
Default lwIP server page

httpserver application default page

The contrib area of the lwIP source code repository contains several sample applications, one of which is a basic Web server application. There are two versions, httpserver for use with the lwIP sockets API interface, and httpserver_raw for use with no OS (i.e. implemented via the lwIP raw API).

The application utilizes a dedicated ROMable file system implemented as 'C' source code to provide the page data (html files, jpg images, etc.) served by the lwIP device.

To use this sample application, include httpd.c, fs.c and fsdata.c and the associated header files to your project. Add a call to httpd_init() to initialize the daemon after calling lwip_init() to initialize the stack. If all is good, pointing a Web browser at your lwIP implementation's IP address should display the provided default file system index page.

NOTE: The file system is NOT STANDARD. It creates images of the files and make them part of the software. Using a standard filesystem requires extensive rewrite of httpd.c.

To customize your web pages, you can use the makefsdata utility to generate your own file system. The 'C' source file containing the file system's contents is generated by a utility called 'makefsdata' which is also maintained/distributed as part of this sample application.

There is also a Perl script version of the makefsdata utility if you don't want to go through the effort of compiling the utility. Note though its use is deprecated and it may not include all the features of the compiled 'C' version.

Advertisement