Quick Nav
Samples OverviewProgramming Languages
Threading
Appweb Configurations
Build Samples
Supplied Samples
GoAheadCompat
PollEventLoop
SelectEventLoop
SimpleClient
SimpleEgi
SimpleEsp
SimpleHandler
SimpleModule
SimpleServer
WinEventLoop
See Also
Embedding Appweb
Using EGI
Pages from ROM
Programming Paradigms
Creating Appweb Modules
Creating Appweb Handlers
Appweb Samples
Appweb includes a suite of programming samples that demonstrate basic use of the APIs. Our goal is to get you running as quickly and easily as possible. If you find that a sample that you need is missing, please email dev@mbedthis.com.
The Appweb samples are included with releases of Embedthis Appweb. The samples include full source code,
makefiles and project files (for Windows). You can build the samples or cut and paste code into your own
applications. These samples are installed by default at <InstallDir>/samples and at
/usr/share/appweb-VERSION for Linux. Each sample is a stand-alone directory that may be relocated or copied
to any directory. For Linux a pre-supplied Makefile will be used to build the sample. For Windows, a Visual
Studio project is supplied.
NOTE: Please read Embedding Appweb and Programming Paradigms first before trying the samples.
Samples Overview
If you want to embed HTTP server functionality in your application the key samples are:
- And depending on your application's event model: selectEventLoop,
winEventLoop, pollEventLoop
If you want to create an Appweb handler that will create dynamic content, such as a PHP handler, the key samples are:
Programming Languages
The samples are grouped by programming language. Most samples are provided as both C and C++ samples.
The samples to create Appweb handlers or modules are only relevant in C++.
Threading Models
The differences in Appweb APIs when using single Vs multithreaded models are quite small. Most samples
pick a model, either single or multithreaded, but in most cases except where explicitly documented, the
sample will work either single or multithreaded.
Appweb Configurations
The samples can only use features that have been built into the installed version of Appweb. If you have
recompiled Appweb from source and have tailored the selected features, some of the samples may not run.
Building Samples
Building on Windows
Appweb includes several project workspace files for building the samples.| Workspace File
|
Description
|
| C++/c++Samples.dsw | Builds all files necessary for the appweb program. Includes building all loadable modules. |
| C/cSamples.dsw | Builds the HTTP client. |
To build using Visual Studio 6 open the workspace files with a "dsw" extension. To build using Visual Studio.NET, open the workspace files and upgrade them to Visual Studio.NET solution files.
Building on Linux
You can build the samples by typing: make. You can clean the directory by typing make clean.Supplied Samples
| Sample Name
|
Languages
|
Threading | Event Model
|
Description
|
| simpleServer
|
C, C++
|
Multithreaded. | Service thread using select
|
Main program HTTP server
|
| simpleEsp
|
C, C++
|
Single / Multithreaded. | Main program HTTP server
|
|
| simpleEgi
|
C, C++
|
Single / Multithreaded. | Main program HTTP server
|
|
| simpleModule
|
C++
|
Multithreaded.
|
Appweb module
|
|
| pollEventLoop
|
C, C++
|
Single-threaded
|
Polling in main program
|
Main program HTTP server
|
| selectEventLoop
|
C, C++
|
Single-threaded | Exposed select in main program
|
Main program HTTP server
|
| winEventLoop
|
C, C++
|
Single-threaded | Windows messages
|
Main program HTTP server
|
| simpleClient
|
C++
|
Multithreaded
|
Main program using the HTTP client
|
|
| simpleHandler
|
C++
|
Multithreaded.
|
Appweb module
|
|
| goaheadCompat
|
C
|
Single-threaded | Main program HTTP server
|