嵌入式系统的网络服务器外文翻译@中英文翻译@外文文献翻译_第1页
嵌入式系统的网络服务器外文翻译@中英文翻译@外文文献翻译_第2页
嵌入式系统的网络服务器外文翻译@中英文翻译@外文文献翻译_第3页
嵌入式系统的网络服务器外文翻译@中英文翻译@外文文献翻译_第4页
嵌入式系统的网络服务器外文翻译@中英文翻译@外文文献翻译_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

北京工业大学毕业设计(译文) - 7 - The DIL/NetPCs DNP/1110 Using the Embedded Linux Web Server for Embedded Systems After the “everybody-in-the-Internet-wave” now obviously follows the “everything-in-the-Internet-wave”. The most coffee, vending and washing machines are still not available about the worldwide net. However the embedded Internet integration for remote maintenance and diagnostic as well as the so-called M2M communication is growing with a considerable speed rate. Just the remote maintenance and diagnostic of components and systems by Web browsers via the Internet, or a local Intranet has a very high weight for many development projects. In numerous development departments people work on completely Web based configurations and services for embedded systems. The remaining days of the classic user interface made by a small LC-display with front panel and a few function keys are over. Through future evolutions in the field of the mobile Internet, Bluetooth-based PANs (Personal Area Networks) and the rapidly growing M2M communication (M2M=Machine-to-Machine) a further innovating advance is to be expected. The central function unit to get access on an embedded system via Web browser is the Web server. Such Web servers bring the desired HTML pages (HTML=Hyper Text Markup Language) and pictures over the worldwide Internet or a local network to the Web browser. This happens HTTP-based (Hyper Text Transfer Protocol). A TCP/IP protocol stack that means it is based on sophisticated and established standards manages the entire communication. Web server (HTTP server) and browser (HTTP client) build TCP/IP-applications. HTTP achieved a phenomenal distribution in the last years. Meanwhile millions of user around the world surf HTTP-based in the World Wide Web. Today almost every personal computer offers the necessary assistance for this protocol. This status is valid more and more for embedded systems also. The HTTP spreads up with a fast rate too. 北京工业大学毕业设计(译文) 8 The DIL/NetPCs DNP/1110 Using the Embedded Linux 1. TCP/IP-based HTTP as Communication Platform HTTP is a simple protocol that is based on a TCP/IP protocol stack (picture 1.A). HTTP uses TCP (Transmission Control Protocol). TCP is a relative complex and high-quality protocol to transfer data by the subordinate IP protocol. TCP itself always guarantees a safeguarded connection between two communication partners based on an extensive three-way-handshake procedure. As a result the data transfer via HTTP is always protected. Due to the extensive TCP protocol mechanisms HTTP offers only a low-grade performance. Figure 1: TCP/IP stack and HTTP programming model HTTP is based on a simple client/server-concept. HTTP server and client communicate via a TCP connection. As default TCP port value the port number 80 will be used. The server works completely passive. He waits for a request (order) of a client. This request normally refers to the transmition of specific HTML documents. This HTML documents possibly have to be generated dynamically by CGI. As result of the requests, the server will answer with a response that usually contains the desired HTML documents among others (picture 1.B). GET /test.htm HTTP/1.1 Accept: image/gif, image/jpeg, */* User selling agent: Mozilla/4.0 Host: Listing 1.A: HTTP GET-request HTTP/1.1 200 OK Date: Mon, 06 Dec 1999 20:55:12 GMT Server: Apache/1.3.6 (Linux) Content-length: 82 Content-type: text/html Test-Seite Test-Seite 北京工业大学毕业设计(译文) 9 The DIL/NetPCs DNP/1110 Using the Embedded Linux Listing 1.B: HTTP response as result of the GET-request from listing 1.A HTTP requests normally consist of several text lines, which are transmitted to the server by TCP. The listing 1.A shows an example. The first line characterizes the request type (GET), the requested object (/test1.htm) and the used HTTP version (HTTP/1.1). In the second request line the client tells the server, which kind of files it is able to evaluate. The third line includes information about the client- software. The fourth and last line of the request from listing 1.A is used to inform the server about the IP address of the client. In according to the type of request and the used client software there could follow some further lines. As an end of the request a blank line is expected. The HTTP responses as request answer mostly consist of two parts. At first there is a header of individual lines of text. Then follows a content object (optional). This content object maybe consists of some text lines in case of a HTML file or a binary file when a GIF or JPEG image should be transferred. The first line of the header is especially important. It works as status or error message. If an error occurs, only the header or a part of it will be transmitted as answer. 2. Functional principle of a Web Server Simplified a Web server can be imagined like a special kind of a file server. Picture 2.A shows an overview. The Web server receives a HTTP GET-request from the Web browser. By this request, a specific file is required as answer (see step 1 into picture 2.A). After that, the Web server tries to get access on the file system of the requested computer. Then it attempts to find the desired file (step 2). After the successful search the Web server read the entire file (step 3) and transmit it as an answer (HTTP response comprising of header and content object) to the Web browser (step 4). If the Web server cannot find the appropriate file in the file system, an error message (HTTP response which only contains the header) is simply be send as response to the client. Figure 2: Functional principle from Web server and browser 北京工业大学毕业设计(译文) 10 The DIL/NetPCs DNP/1110 Using the Embedded Linux The web content is build by individual files. The base is build by static files with HTML pages. Within such HTML files there are references to further files embedded these files are typically pictures in GIF or JPEG format. However, also references to other objects, for example Java-Applets, are possible. After a Web browser has received a HTML file of a Web server, this file will be evaluated and then searched for external references. Now the steps 1 to 4 from picture 2.A will run again fo r every external reference in order to request the respective file from the corresponding Web server. Please note, that such a reference consists of the name or IP address of a Web server (e.g. ), as well as the name of the desired file (e.g. picture1.gif). So virtually every reference can refer to another Web server. In other words, a HTML file could be located on the server ssv-embedded.de but the required picture -which is external referenced by this HTML file- is located on the Web server . Finally this (worldwide) networking of separate objects is the cause for the name World Wide Web (WWW). All files, which are required by a Web server, are requested from a browser like the procedure shown on picture 2.A. Normally these files are stored in the file system of the server. The Webmaster has to update these files from time to time. A further elementary functionality of a Web server is the Common Gateway Interface (CGI) -we have mentioned before. Originally this technology is made only for simple forms, which are embedded into HTML pages. The data, resulting from the padding of a form, will be transmitted to a Web server via HTTP-GET or POST-request (see step 1 into picture 2.B). In such a GET- or POST-request the name of the CGI program, which is needed for the evaluation of a form, is fundamentally included. This program has to be on the Web server. Normally the directory /cgi-bin is used as storage location. As result of the GET- or POST-request the Web server starts the CGI program located in the subdirectory /cgi-bin and delivers the received data in form of parameters (step 2). The outputs of a CGI program are guided to the Web server (step 3). Then the Web server sends them all as responses to the Web browser (step 4). 3. Dynamic generated HTML Pages In contradiction to a company Web site server, which informs people about the product program and services by static pages and pictures, an embedded Web server has to supply dynamically generated contents. The embedded Web server will generate the dynamic pages in the moment of the first access by a browser. How else could we check the actual temperature of a system via Internet? Static HTML files are not interesting for an embedded Web server. The most information about the firmware version and service instructions are stored in HTML format. All other tasks are normally made via dynamic generated HTML. There are two different technologies to generate a specific HTML page in the moment of the request: First the so-called server-side-scripting and second the CGI programming. At the server-side-scripting, script code is embedded into a HTML page. If required, this code will be carried out on the server (server-sided). 北京工业大学毕业设计(译文) 11 The DIL/NetPCs DNP/1110 Using the Embedded Linux For this, there are numerous script languages available. All these languages are usable inside a HTML-page. In the Linux community PHP is used mostly. The favourite of Microsoft is VBScript. It is also possible to insert Java directly into HTML pages. Sun has named this technology JSP (Java Server Pages). The HTML page with the script code is statically stored in the file system of the Web server. Before this server file is delivered to the client, a special program replaces the entire script code with dynamic generated standard HTML. The Web browser will not see anything from the script language. Figure 3: Single steps of the Server-Side-Scripting Picture 3 shows the single steps of the server-side-scripting. In step 1 the Web browser requests a specific HTML file via HTTP GET-request. The Web server recognizes the specific extension of the desired file (for example *.ASP or *.PHP instead of *.HTM and/or *.HTML) and starts a so-called scripting engine (see step 2). This program gets the desired HTML file including the script code from the file system (step 3), carry out the script code and make a new HTML file without script code (step 4). The included script code will be replaced by dynamic generated HTML. This new HTML file will be read by the Web server (step 5) and send to the Web browser (step 6). If a server-sided scripting is supposed to be used by an embedded Web server, so you have to consider the necessary additional resources. A simple example: In order to carry out the embedded PHP code into a HTML page, additional program modules are necessary for the server. A scripting engine together with the embedded Web server has to be stored in the Flash memory chip of an embedded system. Through that, during run time more main memory is required. 4. Web Server running under Linux Once spoken about Web servers in connection with Linux most people immediately think of Apache. After investigations of the Netcraft Survey this program is the mostly used Web server worldwide. Apache is an enhancement of the legendary NCSA server. The name Apache itself has nothing to do with Red Indians. It is a construct from A Patchy Server because the first version was put together from different code and patch files. Moreover there are numerous other Web servers - even for Linux. Most of this are standing under the GPL (like Apache) and can be used license free. A very extensive overview you can find at /. Every Web server has his advantages and disadvantages. Some are developed for specific functions and have very special qualities. Other distinguishes at best through their reaction rate at many simultaneous requests, as well as the variety of their 北京工业大学毕业设计(译文) 12 The DIL/NetPCs DNP/1110 Using the Embedded Linux configuration settings. Others are designed to need minimal resources and offer very small setting possibilities, as well as only one connection to a client. The most important thing by an embedded Web server is the actual resource requirements. Sometimes embedded systems offer only minimal resources, which mostly has to be shared with Linux. Meanwhile there are numerous high- performance 32-bit-386/486-microcontroller or (Strong)ARM-based embedded systems that own just 8 Mbytes RAM and 2 Mbytes Flash-ROM (picture 4). Outgoing from this ROM (Read-only-Memory, i.e. Flash memory chips) a complete Linux, based on a 2.2- or 2.4-Kernel with TCP/IP protocol stack and Web server, will be booted. HTML pages and programs are also stored in the ROM to generate the dynamic Web pages. The space requirements of an embedded system are similar to a little bigger stamp. There it is quite understandable that there is no place for a powerful Web server like Apache. Figure 4: Embedded Web Server Module with StrongARM and Linux But also the capability of an Apache is not needed to visualize the counter of a photocopier or the status of a percolator by Web servers and browsers. In most cases a single Web server is quite enough. Two of such representatives are boa () and thttpd (). At first, both Web servers are used in connection with embedded systems running under Linux. The configuration settings for boa and thttpd are poor, but quite enough. By the way, the source code is available to the customer. The practicable binary files for these servers are always smaller than 80 Kbytes and can be integrated in the most embedded systems without problems. For the dynamic generation of HTML pages both servers only offer CGI (Common Gateway Interface) as enlargement. Further technologies, like server-side-includes (SSI) are not available. The great difference between an embedded Web server and Apache is, next to the limited configuration settings, the maximal possible number of simultaneous requests. High performance servers like Apache immediately make an own process for every incoming call request of a client. Inside of this process all 北京工业大学毕业设计(译文) 13 The DIL/NetPCs DNP/1110 Using the Embedded Linux further steps will then be executed. This requires a very good programming and a lot of free memory resources during run time. But, on the other hand many Web browsers can access such a Web server simultaneously. Embedded Web server like boa and thttpd work only with one single process. If two users need to get access onto a embedded Web server simultaneously, one of both have to wait a few fractions of a second. But in the environment of the embedded systems that is absolutely justifiable. In this case it is first of all a question of remote maintenance, remote configuration and similar tasks. There are not many simultaneous requests expected. 北京工业大学毕业设计(译文) 14 The DIL/NetPCs DNP/1110 Using the Embedded Linux List of Figures Figure 1: TCP/IP stack and HTTP programming model Figure 2: Functional principle from Web server and browser Figure 3: Single steps of the Server-Side-Scripting Figure 4: Embedded Web Server Module with StrongARM and Linux Listings Listing 1.A: HTTP GET-request Listing 1.B: HTTP response as result of the GET-request from listing 1.A Contact SSV Embedded Systems Heisterbergallee 72 D-30453 Hannover Tel. +49-(0)511-40000-0 Fax. +49-(0)511-40000-40 Email: salesist1.de Web: www.ssv-embedded.de Document History (Sadnp05.Doc) Revisio n Date Name 1.00 24.05.2002 First Version KDW This document is meant only for the internal application. The contents of this document can change any time without announcement. There is taken over no guarantee for the accuracy of the statements. Copyright SSV EMBEDDED SYSTEMS 2002. All rights reserved. INFORMATION PROVIDED IN THIS DOCUMENT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND. The user assumes the entire risk as to the accuracy and the use of this document. Some names within this document can be trademarks of their respective holders. 北京工业大学毕业设计(译文) 15 嵌入式系统的网络服务器 在“每个人都处在互联网的浪潮中”之后,现在很明显随之而来的是“每件事都处在互联网的浪潮中”。大多数售卖咖啡的机器仍然不能提供全世界的联网。然而嵌入式远程维护和诊断的网络集成就像所谓的 M2M 通信一样以一种相当快的速度增长。 对很多发展工程来说,仅仅是通过网络浏览器经 Internet,或是经过局域网进行组成和系统的远程维护和诊断,负担非常之重。在许多部门中,人们对于嵌入式系统配置和服务的工作完全地基于网络。剩余的时间用前面的面板和一些功 能键组成一个小的 LC 显示结束经典用户界面的制作。随着移动互联网领域将来的发展,可以预期,基于蓝牙技术的个人区域网和快速发展的M2M 通信会出现长足的进步。 经过网络浏览器获得进入一个嵌入式系统最主要的功能单元是网络服务器。这种网络服务器给网络浏览器带来全球互联网或局域网上理想的 HTML 页( HTML Hypertext Markup Language, 超文本链接标示语言)和图片。这样发生了基于 HTTP( HTTP Hypertext Transfer Protocol, WWW 服务程序所用的协议)。一个 TCP/IP 协议层,意味着基于这个已制定的标准,来管理整个通信。网络服务器( HTTP 服务器端)和浏览器( HTTP 客户端)构建了 TCP/IP 的应用软件。 HTTP 在去年达到了一个显著的区分。其间全世界数以百万计的用户在广域网中使用基于 HTTP 进行冲浪。今天几乎每一台个人电脑都对这个协议提供了必要的支持。这种状况在嵌入式系统中也越来越多。 HTTP 在以极快的速度伸展。 1 基于 TCP/IP 的 HTTP 作为通信平台 HTTP 是一个基于 TCP/IP 协议层之上的简单的协议。 HTTP 使用 TCP( TCP Transfer Control Protocol, 传输控制协议)。 TCP 是一个通过下属的 IP( IP Internet Protocol, 网际协议)协议传输数据的相对复杂和高质量的协议。 TCP 本身经过一个广泛的三方握手程序,始终保证两个通信伙伴之间安全的连接。因此经过 HTTP 的数据传输可以始终被保护。由于广泛的 TCP 协议机制, HTTP 只表现出一种低级别的性能。 北京工业大学毕业设计(译文) 16 Figure 1: TCP/IP stack and HTTP programming model HTTP 基于一种简单的客户 /服务器的概念。 HTTP 服务器和客 户端经过一个 TCP 连接进行通信。默认的端口号是 80。服务器完全被动地工作。他等待客户端的请求。这种请求通常指明确的HTML 文件的传输。这种 HTML 文件可能不得不由 CGI( CGI Common Gateway Interface , 公共网关接口)动态产生。请求的结果,服务器通常将包含的需要的 HTML 文件通过响应回答(Picture 1.B)。 HTTP 的请求通常由几行文本组成,通过 TCP 传送到服务器。 Listing 1.A 给出了一个例子。第一行表明了请求类型( GET),请求对象( /test1.htm)以及 使用 HTTP 的版本( HTTP/1.1)。请求的第二行客户端告诉服务器能够接收什么类型的文件。第三行包括了关于客户端软件的信息。请求的第四行也是最后一行通知服务器客户端的 IP 地址。依照请求的类型以及应用的客户端软件可以写出更多行。可以用一个空行作为请求的结尾。 GET /test.htm HTTP/1.1 Accept: image/gif, image/jpeg, */* User selling agent: Mozilla/4.0 Host: Listing 1.A: HTTP GET-request HTTP/1.1 200 OK Date: Mon, 06 Dec 1999 20:55:12 GMT Server: Apache/1.3.6 (Linux) Content-length: 82 Content-type: text/html Test-Seite Test-Seite Listing 1.B: HTTP response as result of the GET-request from listing 1.A 作为对 HTTP 请求的回答主要由两部分组成。首先有一个个别文本行的标题。跟着又一个内容对象(可选择)。这个内容对象大概由一些文本行组成,假设是一个 HTML 文件或者二进制文件,这时候可以传送 GIF 或 JPEG 格式的图像。标题的第一行特别重要。它起着报告状态和错误信息的作用。如果发生错误,只传送标题或标题的一部分作为回答。 北京工业大学毕业设计(译文) 17 2 网络服务器的功能原理 简单化一个网络服务器可以被设想成像一个特殊类型的文件服务器。 Picture 2.A 展示出了总体结构。网络服务器从网络浏览器接收了一个 HTTP 的 GET 请求。通过这个请求,必须有一个明确的文件作为回答(见 Picture 2.A 中的 Step1)。之后,网络服务器尝试进入被请求电脑的文件系统。然后尝试找到一个需要的文件( Step2)。在成功搜寻之后,网络服务器读取整个文件( Step3),作为一个回答传送回网络浏览器( HTTP 响应由标题和内容对象组成)。如果网络服务器不能在文件系统中找到合适的文件,一个错误信息(只包含标题的 HTTP 响应)简单地作为响应发送到客户端。 Figure 2: Functional principle from Web server and browser 网络的内容由单独的文件构建。它的基础是用 HTML 页的静态文件构建的。在这些 HTML 文件里涉及到远程文件的嵌入。这些文件是 GIF 或 JPEG 格式的这些有代表性地图片。然而也涉及到其它一些对象,例如可能有 JAVA 程序。在网络浏览器接收到网络服务器的 HTML 文件之后,这个文件将被评价然后为外部参考搜索。现在 Picture 2.A 的 1 4 步将为每一个外部参考再一次运行,为了从相应的网络服务器中请求各自的文件。请注意,这 样一个参考由网络服务器的名字或IP 地址组成(例如“ ”),需要文件的名字也是如此(例如“ picture1.gif”)。所以事实上每一个参考都能够查阅另一个服务器。换句话说,一个 HTML 文件能够定位在服务器“ ssv embedded.de”上,但通过这个 HTML 文件外部涉及到的需要的图像定位在网络服务器“ ”上。最后这个分离对象的网络是万维网( WWW)得名的原因。所有通过网络服务器的必须得文件被浏览器请求,就像 Picture 2.A 中展示的那样。通常这些文件被存储在 网络服务器的文件系统中,网络管理员有时会更新它们。 网络服务器更进一步的基本功能是我们前面提到的公共网关接口( CGI Common Gateway Interface , 公共网关接口)。最初这项技术只应用于简单的嵌入 HTML 页的窗体。作为窗体填料结果的数据将经 HTTP GET 或 POST request 被传送到网络服务器(见 Picture 2.B 的 Step1)。在这样一个 GET或 POST的请求中, CGI 需要被窗体赋值的程序名已经被包括进去。这个程序需要放在网络服务器上。通常存储在“ /cgi bin”目 录中。 GET或 POST请求的结果是网络服务器启动位于“ /cgi bin”目录中的 CGI 程序,根据参数传递标准的数据( Step2)。一个 CGI 程序的输出导向到网络服务器( Step3)。然后网络服务器把数据全部传送到网络浏览器作为响应( Step4)。 3 动态产生 HTML 页 与一个公司通过静态页面和图片告诉人们有关产品计划和服务的网页相反,一个嵌入式的网北京工业大学毕业设计(译文) 18 络服务器能够提供动态产生的内容。它将在首先通过浏览器进入的时候产生动态页面。如何另外通过 Internet 检查系统的实际温度?静态 HTML 文件对一个嵌入式 的网络服务器来说没有什么意思。最多关于固件的版本和服务的信息是通过 HTML 格式存储的。另外所有其它的任务通常都是由动态产生 HTML 完成的。 在请求的时刻有两种产生 HTML 页的不同技术:第一种是所谓的服务器方脚本,第二种是 CGI设计。在服务器方脚本中,脚本代码嵌入到 HTML 页中。如果需要,这些代码将在服务器方被执行。 因此,有许多种可以提供的脚本语言,这些语言在 HTML 页中都可用。在 Linux 团体中主要使用 PHP( PHP:一种新型的 CGI 网络程序编写语言。)。微软中意的是 VBScript。在 HTML 页中插入 JAVA 同样可能。美国的 Sun 公司将这种技术命名为 JSP。用脚本代码编写的网页静态地存储在网络服务器的文件系统之中。在服务器的文件被传送到客户端之前,一段特殊的程序用

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论