实例介绍
嵌入式web服务器及远程测控应用详解v0.1
嵌入式WEB服务器及远程测控应用详解V0.1 ahttp://211.87.99.168/measure02.html-microsoftInterneteXplorer 文件編辑(查看(0收藏(④工具(D帮助出 后退·③·的的聚索次收藏圆·《图 转到 ey·搜索网页 P@·,·团回如),共享间,路8(1)·@ ARM9远程实时测量技术 具 温度测量点(1-4): 1) Hannelore18.5℃ 2)Channel two 21.5℃C Channelthre620.5℃ ) Channel four19.5℃ 小应用程序 JwebcamPlarer started so Internet 图2ARM9远程实时视频及温度测量 ARM入式WEB服务器 Mozilla Build D2002516日x 文件(E)编辑(E)查看(转到G)书签B工具①窗口w帮助田 rot的主目 ·画·最、题体即的上清· 叠主页书签∠ Red Hat Network CSt甲 port ishop Products Training 从这里开际网贡一 首页 时钟显 LED控制 时钟显艺 回收站 时钟显 XML技术 选择LED闪烁模式 CD3闪烁D2不动 温度测量及 CD2闪烁D3不动 CG测试网页 CD2D3同步闪烁 终端 Hello w D2D3交替闪烁 返回环壇 选择LED闪烁周期: cGl控制网页 C 250ms LED控 C 500ms onqueror 览器 打开视频 1000ms CG测量网页 确定重设 温度 频获 Your ip is211.87.99.169 完成 1月25五 ARM嵌入式WEB服务 15:19 图3复杂的LED控制 嵌入式wEB服务器及远程测控应用详解ⅴ0.1 2e家庭- Microsoft Internet Explorer 文件)编辑(查看(收藏A工具(T帮助 ③成·,刘2径户抛☆收头的,操圆,q 地址h21:9163med 分转到链 器(2).qg Google 魏索心@资讯卧按库·M,书签,已4个翻译,字词标明 设置 e家庭 9.0 室内湿度 Copyright(c)www.pyycomAllrightsreserved 南京师范大学物科院嵌入式研究小组版权所有 图4家庭坏境监测 实时波形- Microsoft Intemet Explorer 文件)编辑()查看)收藏A)工具)帮助H ·份图哈户次收买回·《图 地址◎)erp∥2 168ishishi, html 转到接 搜索网页 1D,四,¥·/团,共空同,器()·9 Google 搜索國资讯按库,M·书,卧已拦截4个翻,索词明 设置 实时波形 t Copyright(c)www.pyy.comAllrightsreserved 南京师范大学物科院嵌入式研究小组版权所有 图5实时数据采集及波形显示 嵌入式WEB服务器及远程测控应用详解V0.1 第一章嵌入式WEB服务器的移植及注意点 嵌入式WEB服务器种类很多,下面提供各种小型服务器的连接。此文摘自 http://www.ibm.com/developerworks/cn/web/wa-itwebserv/index.html 小型Web服务器包括 Cheetah serve,用不到一千行的C代编与而成。 Dustmote,一个非常小的Web服务器,用一个大约3000字节的Tc源文件实 现。 ·fnor,人小取决于平台和配置,不超过20K。虽然很小,但是它支持虚拟主机、 CG|和keep-ave。 httpd,使用不到800行的C代码,包括CG,并通过inetd提供页面。 im-httpd,非常小的服务器—只有人约7KB,链接到g1ibc。而且它也非常 快 mattos,支持CG|,只有600行C代码 Scrunch,虽然很小,不到30KB,但是支持多种脚本编语言,包括一种特殊用 途的、基于栈的Sy脚木语言。 ·ZwS演示了一个即使是使用500多行带足够注释的zsh(!)编写的应用程序 在这里是一个HTTP0.9+服务器 也可以有多强大 体积小并不妨碍这些服务器被正式使用。例如, fnord可以处理数千个同时进行的连接。 也许轻量级作为一个类别最令人印象深刻的成就是高性能服务器: httpd是一个小型Web服务器,它被理解为使用26系列内核屮可用的异步功 能的一个试验品。 ·darkhttpd是一个快速的、单线程的HTP/1.1服务器。 · Gatling是为髙性能设计的。它的特性包括FTP、Pv6、虚拟主机、CG|等。 Kernux是一个Linux内核模块,它实现了一个HTTP守护进程。 ·lighttpd是使用率排名第五的Web服务器(排名还在上升)。它为很多同时进行 的连接进行了优化:“典型的场景是使用lighttpd作为一个下载(of-load)服务器, 以提供静态内容.” teSpeed Web Server是一款轻量级商业web服务器,强调性能和安全性。 Lite Speed Technologies公司宣传为静态内容提速∫6倍,在解释贞面方面也有 一定的提高 Miniature jws,也称ws,它是基于Java的Web服务器,可以处理 servlet、 JSP和数千个并发连接,而大小只有77KB。它的作者声称它“比 Apache2x快 10%” ·Yaws是用Erlang绵与的一款高性能HTTP/1.1服务器 有些Web服务器被实现为类或库,以便嵌入到较大的应用程序中。在这出Web服务 器当中,我发现特别有趣的有 EHS——“嵌入式HTTP服务器”,被设计为一个C++类,用」嵌入到较大的C++ 应用稈序;还有 嵌入式WEB服务器及远程测控应用详解V0.1 Embedded tcl Web server,它是一个很普通的Web服务器,支持SsL和 Basicauthentication,速度非常快——其作者仗它至少与lighttpd和 AOLserver一样快。它是用个到100行Tc编与的 Python是几种适合不寻常环境的web服务器的实现语言,这些Web服务器包括: cdServer是一个小型的、用Python编写的HTTP服务器,它“被设计用来提供 来自CD-ROM的(静态)内谷”。它在提供动态内容方面能力有限。我们有几个 涉及不受影响的“ live CDs”的项目,在这些项目中像 cd server之类的工具很关 键 edna,款智能的用Python编写的MP3服务器,它是用HTTP实现的。 还有其他一些用Per和其他不岀名的语言编写的轻量级web服务器: Camlserv,用ocam编写的一个完整的Web服务器,目标是“高度交互式的 Web页面”。它由几千行ocam编写而成,其中大部分代码者与 MySQL和HTML 的特殊处理有关 httpd用和Apache相同的格式记录方问。它支持cGl,并具有内建的Per解 释、虚拟主机、IPν6、带宽管理和安全性等方面的特性。 ·DnhttpD是用Per编写的,用于UNX,它支持虚拟辶机、SSL连接、CG丨等。 · Jellybean是用Per编写的基于HTP的 Perl Object Server ·Inshttp是一个Common凵IsPHttp/1.1Web框架。 Mongrel是用Ruby编写的、用于HTTP的一个库和服务器。 · Nanoweb是用PHP编与的一款快速、健壮的Web服务器。它宣称只有丰富的 特性,包括完全遵从HTTP/11、访问控制、身份验证、虚拟主机、SSL兼容性等。 · Naridesh是用Per编写的Web服务器 OpenAnge是用Per编写的。它强调的重点是安全性 ·Xavante是用Lua编写的HTTP/11Web服务器 XSP是用C#编与的,用于运行 ASP.NET 有时候您可能需要其他一些用C编写的、具有不常见的次要优势的轻量级Web服务器 ABYSS可以在UNX和Win32之间移植,其“目的是成为完全遵从HTTP/11 的Web服务器”。它占用的内存很少。 ·Anti-webhttpd(也称“Anti-Web"、“awhttpd”和AW”)是一款单进程、无线程 支持CG|的服务器,它强调安全性和简单性。 Mhttpd支持从外部文件或LDAP服务器进行的MhttpdBasic Authentication。 mini-httpd可以在个系统线程中处理多个并发请求,但是在主机上占用的内存或 CPU很少 Naken Web类似于很多其他的轻量级服务器—它支持 Basic authentication 静态内容等一但是它的作者将它设计为用」 Webcam操作,并且在 Gumstix WRT54GL、 OpenWrt和其他新的平台上运行。 ·Nullhttpd是款多线程的、简单的、可移植的web服务器。 Seminole是一款商业Web服务器,内存需求较小,功能较多 嵌入式WEB服务器及远程测控应用详解V0.1 ·thttpdthrottle,支持chroot、Basicauthentication等。 在许多应用中我们可以选择不同的服务器。BOA服务器移植参考资料较为全面,在系统设 计中选用它作为嵌入式WEB服务器。 1.1嵌入式BOA服务器栘植 移植过程参考《嵌入式 Linux系统开发详解—基于FP93XⅩ系列ARM》及网终上- 篇文章《wEB服务器-Boa实验笔记》,下面是自己在S3C2410平台上移植Boa的过程 第一步宄成Boa程序的移植 从www.boa.org上下载Boa源码,当前的版木是0.9413,将其解压并进入游码目录的 子目录 tar xzf boa-09413.tar cd boa-094 13/src 生成 Makefile文件 # configure 修改 Makefile文件(注:这里修改根据自己的交叉编译器自行修改),修改EC=qc yy CC =armv4I-unknown-linux-gc 修改CPP=gc CPP= armv4l-unknown-linux-gcc -E 修改头文件 defines h 找到# define server root“/etc/boa”修改成 f define server root /var/www 这里定义的是web服务器的文件根目录(用户可以自行定义,只要跟 boa. conf中设置一致 就可以了 然后运行make进行编译,得到的可执行程序boa,将调试信息剥去,得到的最后程序只有 62872Bytc大小。 armv4l-unknown-linux-strip boa 第二步完成Boa的配置,使其能够支持CGI程序的执行。在boa源码目录下有一个 boa. conf 可以对其作如下修改: Boa v0.94 configuration file File format has not changed from 0.93 File format has changed little from 0.92 version changes are noted in the comments The boa configuration file is parsed with a lex/yacc or flex/bison t generated parser. If it reports an error, the line number will be provided; it should be easy to spot. The syntax of each of these 嵌入式WEB服务器及远程测控应用详解V0.1 t rules is very simple, and they can occur in any order. Where possible #thesedirectivesmimicthoseofNcsahttpd1.3;Isawnoreasonto introduce gratuitous differences SId: boa. conf, v 1, 25 2002/03/22 04: 33: 09 nelson Exp s #f The"Scrvcrroot" is not in this configuration filc. it can be compiled into the server( see delines. h)or specified on the command line with the-c option, for example # #f be /usr/local boa #Port:TheportBoarunson.Thedefaultportforhttpserversis80 #f If it is less than 1024. the server must be started as root Port 80 t Listen: the Internet address to bind(2)to. If you leave it out #f it takes the behavior before 0.93. 17 2. which is to bind to all addresses(INADDR ANy). You only get one "Listen"directive if you want service on multiple ip addresses you have three choices: 1. Run boa without a "listen"directive a. All addresses are treated the same: makes sense if the addresses ######### are localhost, ppp, and eth0 b. Use the VirtualHost directive below to point requests to different files. Should be good for a very large number of addresses(web hosting clients 2. Run one copy of boa per IP address, each has its own configuration with a"Listen "directive. No big deal up to a few tens of addresses Nice separation belween clients The name you provide gets run through inet aton(3), so you have to use dotted quad notation. This configuration is too important to trust some DNS # Listen192.68.0.5 #f User: The name or uid the server should run as Group The group name or gid the server should run as Uscr nobo Group o Server Admin: The email address where server problems should be sent Note: this is not currently used, except as an environment variable 嵌入式wEB服务器及远程测控应用详解ⅴ0.1 #f for Cgis #Server Admin root(localhost Errorlog: The location of the error log file. If this does not start #f with/. it is considered relative to the server root Sct to /dcv/null if you don 't want crrors logged Ifunsel. defaults to/dev/stderr #ErrorLog /var/log/boa/error log Please NOTE: Sending the logs to a pipe (i), as shown below f is somewhat cxpcrimcntal and might fail under heavy load #"Usual libc implementations of printf will stall the whole process if the receiving end of a pipe stops reading #上 rrorLog yusr/sbin/cronolog symlink=/var/log/boa/error log ar/log/boa/error-%Y%m%dlog AccessLog: The location of the access log file. If this does not start with/. it is considered relative to the server root Comment out or set to dev /null (less effective )to disable Access logging. #AccessLog /var/log/boa/access log t Please NOTE: Sending the logs to a pipe (I), as shown below, is somewhat experimental and might fail under heavy load #"Usual libc implementations of printf will stall the whole t process if the receiving end of a pipe stops readin #Accesslog /usr/sbin/cronolog-symlink-/var/log/boa/access log/var/log/boa/ access-%Y%om%d I UseLocaltime: Logical switch. Uncomment to use localtime instead ofUTC time #UseLocaltime Verbose CGILogs: this is just a logical switch It simply notes the start and stop times of cgis in the error log Comment out to disable #VerboseCGilogs Server Namc the namc of this server that should be sent back to clients if different than that returned by gethostname t gethostbyname Servernamewww.your.org.here 嵌入式WEB服务器及远程测控应用详解V0.1 #f VirtualHost: a logical switch Comment out to disable #Givendocumentroot/var/www.requestsoninterlaceaorIpIp-A' become/var/Www/IP-A #Examplehttp:/localhost/becomes/var/www/127.0.0.1 # Not uscd until vcrsion 0.93. 17 2. This"fcaturc"also brcaks commonlog #output rules, it prepends the interface number to each access log line You are expected to fix that problem with a postprocessing script #Virtualhost Documentroot: The root directory of the hTML documents comment out to disable server non user files DocumentRoo t/var/www UserDir: The name of the directory which is appended onto a user's home directory if a -user request is recieved UserDir public html DirectoryIndex: Name of the file to use as a pre-written HTML t directory index. Please MAKE AND USE THESE FILES. On the fly creation of directory indexes can be slow Comment out to always use Directory Maker Directorylndex index html DirectoryMaker: Name of program used to create a directory listing Comment out lo disable directory listings. Ifboth this and DirectoryIndex are commented out accessing a directory will give an error( though accessing files in the directory are still ok) #Directory Maker /usr /ib/boa/boa indexer #f directory Cache: If DirectoryIndex doesn 't exist, and Directory Maker has been commented out, thethe on-the-fly indexing of boa can be used to generate indexes of directories. Be warned that the output is cxtrcmcly minimal and can causc delays when slow disks arc uscd Note The Directory Cache must be writable by the same user/group that boa runs as Directory Cache /var/spool/boa/dircache 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论