Click here to Skip to main content
Click here to Skip to main content

Webio - An embedded web server

By , 20 Jul 2008
 

Introduction

Webio is a small-footprint web server, designed to be embedded in an application or an embedded system. It's useful when you want to implement a complex browser based GUI (which can be accessed by everything from PCs to cell phones) in a very efficient manner. Webio compiles and runs equally well under Linux and Windows, and should be easy to port to most other platforms. It comes with a programmer's manual (progman.html) which explains how to use it and how to port it.

Background

In 1996, I wrote one of the first web servers designed for embedded devices. In those days, most embedded devices had no file systems, so I created the "HTML compiler" to embed the files into the code image. Similarly, the lack of a file system led to C-language CGI functions.

Creating basic GUIs with this system was so easy that I started using it in Windows applications in preference to the Windows GUI. Back then, before JavaScript and CSS, it was somewhat limited - for example, it wouldn't make a very good "photo shop" type program - but for basic GUIs, it was great.

As my company started using Linux and Browser-enabled hand-held devices, a really huge advantage became obvious - my new applications worked everywhere, not just on Windows. The user was not tied on one OS or one type of device. They didn't even have to be near the machine running the application.

In 2007, I needed a similar server for an open-source project. I had left the previous company, which still retained the rights to the my old server. They wouldn't open source it, and nothing suitable was available in the public domain. I decided to create a second generation version of the server and release it under the BSD license so I would never have to write it again.

The result is Webio - my second (and hopefully last) embedded web server.

Using the code

The Windows version is probably of most interest to CodeProject readers, and so the .zip file is made available here. Follow these steps:

  1. Unzip it (preserving the directory structure).
  2. Type buildfs to compile the embedded file system.
  3. Open the project file with Visual C++ 6.0 or newer, and click Build.

You should get a little application which, when run, allows your PC to act as a web server - point a browser at it. You can do this in loopback by typing "http://127.1" in your browser's location bar.

Points of interest

Webio has a few improvements over my first embedded web server:

  • The "HTML compiler" is now a full-fledged file system builder, designed from the group up to generate not only file images in your C code, but also generate code for C-language CGI.
  • The server buffers all code-generated output, allowing accurate Content-Length fields on files with variable sized SSIs.
  • A fast path for binary files improves performance.
  • Portability across Windows/Linux/Embedded systems is enhanced.

History

  • July 2008 - First public release.
  • July 27th - Updated, call this release 1.1. Changes:
    • Added command line option to set the HTTP port (default is still 80).
    • Error message is more helpful if another web server already has port 80.
    • Fixed some typos and omissions in the manual.

License

This article, along with any associated source code and files, is licensed under The BSD License

About the Author

jbartas
Chief Technology Officer praemio.com
United States United States
Member
See my bio here:
 
http://www.bartas.net/resume.htm

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionLinks are dead again...No Makefile in the current download?memberCraig L Soucie20 Nov '12 - 10:12 
Questionpushmembersteve vreeland9 Apr '12 - 4:43 
does anybody have a simple push function that will do something like update a clock on screen?
I could sure use some help here. This is the only thing preventing me from using this as a real UI.
(I realize it was an exercise left for the student...but I can't seem to get there from here)
QuestionJBartas In Supermax Doing ChinupsmemberCleveland Mark Blakemore8 Mar '12 - 19:31 
AnswerRe: JBartas In Supermax Doing Chinupsmemberjbartas9 Mar '12 - 7:34 
AnswerRe: JBartas In Supermax Doing Chinupsmembersteve vreeland9 Apr '12 - 4:40 
QuestionSo awesomememberCleveland Mark Blakemore24 Jan '12 - 20:05 
QuestionUpdate and new site for official sourcesmemberjbartas31 Dec '11 - 15:58 
SuggestionCache flag -c support in fsbuilder.exe [modified]memberMember 156850622 Nov '11 - 1:10 
QuestionBuilding webio for LinuxmemberPeter Dickinson8 Sep '11 - 3:12 
GeneralA couple of allocation/free bugsmemberjbartas17 Sep '10 - 13:44 
Questionmultiple user/password requestmemberpbisiac15 Apr '10 - 9:40 
AnswerRe: multiple user/password requestmemberjbartas18 Apr '10 - 16:34 
GeneralRe: multiple user/password requestmemberrcl18 Feb '11 - 9:09 
SuggestionRe: multiple user/password requestmemberMember 15685064 Nov '11 - 0:37 
GeneralSegmentation faultmemberbiana26 Nov '09 - 21:02 
GeneralRe: Segmentation fault [modified]memberlxlxlx15 Jun '10 - 2:14 
GeneralHeap failure after some timememberpbisiac4 Nov '09 - 5:22 
GeneralRe: Heap failure after some timememberjbartas5 Nov '09 - 6:47 
AnswerRe: Heap failure after some timememberpbisiac9 Nov '09 - 7:04 
GeneralRe: Heap failure after some timememberjbartas15 Nov '09 - 16:40 
GeneralRe: Heap failure after some timememberPanuO19 Apr '10 - 1:34 
Generalwi_putfilememberpbisiac8 Jul '09 - 21:20 
GeneralFile buffering and embedded systemmemberpbisiac7 Jul '09 - 6:03 
GeneralRe: File buffering and embedded systemmemberjbartas7 Jul '09 - 18:32 
GeneralRe: File buffering and embedded systemmemberpbisiac7 Jul '09 - 21:06 
GeneralRe: File buffering and embedded systemmemberpbisiac8 Jul '09 - 20:28 
GeneralRe: File buffering and embedded systemmemberjbartas9 Jul '09 - 8:21 
GeneralADDR_ABORT ARM exception on multiple GETmemberpbisiac3 Jul '09 - 5:22 
GeneralRe: ADDR_ABORT ARM exception on multiple GETmemberpbisiac3 Jul '09 - 6:06 
GeneralRe: ADDR_ABORT ARM exception on multiple GETmemberjbartas6 Jul '09 - 7:25 
Generalwi_putfilememberpbisiac2 Jul '09 - 6:27 
QuestionWhat about AJAX ?memberpbisiac26 Jun '09 - 2:37 
AnswerRe: What about AJAX ?memberjbartas1 Jul '09 - 7:11 
GeneralRe: What about AJAX ?memberpbisiac2 Jul '09 - 20:58 
GeneralThanksmemberZaqro26 Jun '09 - 0:25 
GeneralMakefile for Linuxmemberjbartas11 May '09 - 8:36 
GeneralCompiling with Linuxmemberel06b15027 Apr '09 - 22:29 
GeneralRe: Compiling with Linuxmemberjbartas11 May '09 - 8:21 
GeneralRe: Compiling with LinuxmemberMember 14030153 Sep '09 - 1:10 
GeneralRe: Compiling with LinuxmemberMember 362026328 Nov '09 - 5:57 
QuestionWhy don't you add webio to wiki?membersoltan1 Dec '08 - 21:45 
GeneralReturning file with a dynamically generated URLmemberasamama14 Nov '08 - 2:59 
QuestionCould we please have this wonderfule cWebio ?memberMicroImaging24 Oct '08 - 12:29 
AnswerRe: Could we please have this wonderfule cWebio ?memberravenspoint24 Nov '08 - 16:57 
GeneralA new release is ready.memberjbartas5 Oct '08 - 13:43 
GeneralWt -> webtoolkit.eumemberpgquiles13 Sep '08 - 1:23 
QuestionImpressive - but what about boost/asio?memberEllers6 Aug '08 - 13:25 
GeneralLink errormemberNagrom28 Jul '08 - 3:02 
GeneralRe: Link errormemberjbartas29 Jul '08 - 5:31 
GeneralRe: Link errormemberNagrom30 Jul '08 - 8:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 20 Jul 2008
Article Copyright 2008 by jbartas
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid