Skip to main content

How to implement webserver

This article explains how to implement a simple web-server on Toradex Computer Modules.

Overview

Web-server refer to an application that helps to deliver web content that can be accessed through Internet/Intranet. Hosting web-server on device establishes the communication between client and server using Hyper Text Transfer Protocol(HTTP). Webpage may include images, script, etc.

Use cases:

  • Home Automation
  • Sever Room monitoring system
  • and many more..

HTTPD web-server

The HTTPD is a Windows CE based built-in web-server that enables you to monitor, configure, and remotely control a device through the use of a HTTP server. You can include additional catalog items in your OS design to add support for authentication, Internet Server Application Program Interface (ISAPI) extensions, ISAPI filters, and/or active server pages (ASP). Services.exe loads the Web-server at system startup.

ISAPI extension example

ISAPI extensions provide a means of scripting for the Web-server which you can use to create and run dynamic, interactive web-server applications. ISAPI extensions are implemented as DLLs that are loaded into the same process as the Web-server.

This demo application demonstrates how to Add/Remove User, Flush Registry and perform a web server restart.

Steps to run the demo
  • Download demo source code from here.
  • Create the following registry Keys

[HKLM\Comm\HTTPD\VROOTS\ISAPI\]
"a"=dword:0
"Default"="\windows\isapi.dll"

  • Save the registry settings and reboot the module.
  • Build and deploy solution.
  • Now, on your browser you can access the extension at http://IP/isapi/.

Web-server implementation from scratch

Following are the demos to show web-server implementation from scratch. Please note we have used Colibri Evaluation Board V3.1 for the demo applications, if you want to use Iris or other carrier boards, please configure GPIOs accordingly in the application.

Demo Application 1

This application shows how to implement a simple web-server and control LEDs using it.

Hardware Setup
  • Connect X9 (SODIMM_45, SODIMM_55, SODIMM_63, SODIMM_100) to X21 (LED1, LED2, LED3, LED4) on Colibri Evaluation Board V3.1
Steps to run the demo
  • Download application(1) source code from here.
  • Open the project in VS2008 and change the IP address in webserver1.c according to IP address of Module. You can get IP address using ipconfig command in command prompt.
  • Deploy the program and go to My Device->Program Files->webserverdemo1 and run webserverdemo1.exe.
  • Open PC/Mobile browser, type IP address followed by port number as mentioned in source code. (e.g IP_ADDRESS:PORT_NUMBER, 10.18.0.249:10000)

Webpage will be displayed as shown below.

Demo Application 2

This application shows how to implement a web-server consisting of Image (Toradex Logo) and button controls for LEDs.

Hardware Setup
  • Connect X9 (SODIMM_45, SODIMM_55, SODIMM_63, SODIMM_100) to X21 (LED1, LED2, LED3, LED4) on Colibri Evaluation Board V3.1
Steps to run the demo
  • Download application(2) source code from here.
  • Open the project in VS2008 and change the IP address in webserver2.c according to IP address of Module. You can get IP address using ipconfig command in command prompt.
  • Deploy the program and go to My Device->Program Files->webserverdemo2 then run webserverdemo2.exe.
  • Open PC/Mobile browser, type IP address followed by port number as mentioned in source code.

Webpage will be displayed as shown below.

Demo Application 3

This application shows how to implement an advanced web-server using AJAX, CSS, HTML5 Canvas.

Hardware Setup
  • Connect X10 (SODIMM_86, SODIMM_88, SODIMM_90, SODIMM_92) to X21 (LED1, LED2, LED3, LED4) and Connect X10 (SODIMM_28, SODIMM_30, SODIMM_67), X9 (SODIMM_100) to X21 (SW1, SW2, SW3, SW4) on Colibri Evaluation Board V3.1.
  • Connect X9 (SODIMM_45) to X21 (SW5) on Colibri Evaluation Board V3.1.
  • For temperature gauge analog signal is fed to ADC channel 2 and pressure gauge is showing software generated dummy values.
  • SW5 is used to close the web-server (running) application.
Steps to run the demo
  • Download application(3) source code from here.
  • Open the project in VS2008 and change the IP address in webserver3.c according to IP address of Module. You can get IP address using ipconfig command in command prompt.
  • Deploy the program and go to My Device->Program Files->webserverdemo3 then run webserverdemo3.exe.
  • Open PC/Mobile browser, type IP address followed by port number as mentioned in source code.

Webpage will be displayed as shown below.



Send Feedback!