Network Component  Version 7.4.0
MDK Middleware for IPv4 and IPv6 Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
HTTP Server

The HTTP Server example uses a fixed set of web pages stored in ROM, but is capable of exchanging information with the underlying hardware by using the CGI interface. The following picture shows an exemplary connection of the development board and a Computer.


The Abstract.txt file contained in the Documentation group of the Project window gives you more information on the general setup and the available I/O of the development board.

Build the "HTTP Server" Project

Open the example project in MDK (the Pack Installer's web page explains how to do this). The ┬ÁVision Project window should display a similar project structure:

Compact Web Server Project Structure

Source Files

  • HTTP_Server.c contains the main C function that initializes the board hardware and the Network Component.
  • The HTTP_Server_CGI.c defines the functions for the scripting language for communication with the hardware.
  • Web.c is a compiled file that will be generated by the FCARM tool from all the web input files.
  • The Web files group contains all the HTML and CGI files that will be compiled into the Web.c file. The files in this group determine the actual layout of the web page and the behaviour of the different subpages using CGI.
  • A HTTP_Server_Multiuser.c file can be added using the User code template feature. This file is used for specifying multiple users and access rights for these users.
  • Adding the HTTP_Server_Access.c file enables the server to accept or block connection requests from certain remote clients.
  • The user code template file HTTP_Server_Error.c contains the information that the web server is showing in case of errors (such as Error 404).

You may now build and download the example project to the evaluation board using the ┬ÁVision commands:

  • Project –> Build target
  • Flash –> Download

After these steps, the project should start executing on your evaluation kit. In case of errors, refer to the Evaluation Board User's Guide for configuration information. If you want to know how the file converter works that is required to compile the web pages into a single C file, please visit the File Converter FCARM page.

MDK Middleware 7.1.0 and above offers security extensions that can be used to convert the HTTP into a HTTPS server. Follow the instructions as described on page Converting the HTTP server to HTTPS.

Using the "HTTP Server" Project

Hardware Setup

The setup of the Evaluation Board hardware is described in the Abstract.txt file.

  • Verify all jumper settings on the target hardware.
  • Use an Ethernet cable to connect your development board to the local area network. The PC is assumed to be already in this LAN.

PC Software

The web server can be tested on any PC using any browser available. Simply, type in the Local Host Name that is defined in the Net_Config.c file. The default name is my_host. If you have a DCHP server in your network, you will be automatically connected. You need to log in. As for all network examples, use "admin" (without the quotes) for the user and no password (you can change the defaults in the Net_Config_HTTP_Server.h file). The following (or a similar) page will come up in your browser:


If you get an error message, please verify that all network, IP and other settings are correct.