The WebServer component is included in VxWorks. Select http server under network components> network protocols> network applications. You can also use rapid control for Web. Here we will introduce GoAhead WebServer, which is an embedded WebServer with free source code, powerful functionality, and running on multiple platforms.
GoAhead WebServer has the following main features:
L support ASP
L embedded JavaScript
L Standard CGI execution
L CGI processing in memory GoFroms
L extended API
L fast response, handling more than 50 requests per second
L completely compatible with the standard
L if SSI is not included, only 60 kb of memory is required; if SSI is included, KB of memory is required.
L web pages can exist in ROM or File System
L supports multiple operating systems, including eCos, LINUX, LynxOS, QNX, VxWorks, WinCE, pSOS, etc.
The following describes how to set up the GoAhead WebServer through the downloadable project. Of course, you can also integrate it into the bootable project in a similar way:
① Download the latest GoAhead Webserver.
② Create a bsp-based downloadable project named goaheadweb.
③ Add the following downloaded source files to the project:
Balloc. c
Base64.c
Default. c
Ejlex. c
Ejparse. c
Emfdb. c
Form. c
H.c
Handler. c
Md5c. c
Mime. c
Misc. c
Page. c
Ringq. c
Rom. c
Security. c
Sock. c
SockGen. c
Sym. c
Uemf. c
Um. c
Umui. c
Url. c
Value. c
Webrom. c
Webs. c
Asp. c
Websuemf. c
Cgi. c
/Vxworks/main. c
④ Refer to/vxworks/makefile to modify the makefile of the project.
Add definition-DWEBS-DUEMF-DOS = "VXWORKS"-DVXWORKS in makefile
As follows:
CFLAGS =-g-m1_- ansi-nostdinc-release-D_REENTRANT-DWEBS-DUEMF-DOS = "VXWORKS"-DVXWORKS-fvolatile-nostdlib-fno-builtin-fno-defer-pop -I. -IE:/Tornado-x86/target/h-DCPU = i80133
To support user management and access control, add the following definitions:
-DUSER_MANAGEMENT_SUPPORT
-DDIGEST_ACCESS_SUPPORT
For details, refer to the original makefile.
⑤ Modify/vxworks/main. c according to the document.
Set the root directory, for example
# Define ROOT_DIR T ("/tffs0/webs ")
Set the default homepage
Webssetdefapage page (T ("index. asp "));
Use ftp and other tools to bring home pages such as index. asp to tffs0.
6. compile it as goaheadweb. out for download.
7. Load webserver under WindShell
Sp websvxmain
Enter http: // 192.168.0.2/index. asp in the browser to access the/tffs0/webs/index. asp file.
⑨ Asp programming:
GoAhead Asp programming requires a pre-defined Asp function. The following example is provided in the initWebs () function of main. c:
WebsAspDefine (T ("aspTest"), aspTest );
Here, aspTest () is defined as an Asp function. You can provide relevant functions for the functions you want to complete, such:
/*
* Test Javascript binding for ASP. This will be invoked when "aspTest" is
* Embedded in an ASP page. See web/asp. asp for usage. Set browser
* "Localhost/asp. asp" to test.
*/
Static int aspTest (int eid, webs_t wp, int argc, char_t ** argv)
{
Char_t * name, * address;
If (ejArgs (argc, argv, T ("% s"), & name, & address) <2 ){
WebsError (wp, 400, T ("Insufficient args \ n "));
Return-1;
}
Return websWrite (wp, T ("Name: % s, Address % s"), name, address );
}
Then, you can call the Asp function on the Asp page, as shown in the preceding example:
<H2> Expanded ASP data: <% aspTest ("Peter Smith", "112 Merry Way"); %>
※Note: to stop or restart the WebServer, do not use taskDelete or td to delete the webserver task. Instead, call kill () to send a signal of 9 or 15 to the webserver task.
GoAhead details: click here
GoAhead: click here
Upload files to the embedded Web server on the GoAhead.
Migrate GoAhead 2.5 embedded Web server to 2440 + Linux
Migrate GoAhead to uClinux