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

下载本文档

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

文档简介

The DIL/NetPCs DNP/1110 Using the Embedded LinuxWeb Server for Embedded SystemsAfter 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.20The DIL/NetPCs DNP/1110 Using the Embedded Linux1. TCP/IP-based HTTP as Communication PlatformHTTP 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 modelHTTP is based on a simple client/server-concept. HTTP server and client communicate via a TCP connection. As default TCP port value the port number80 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.1Accept: image/gif, image/jpeg, */* User selling agent: Mozilla/4.0Host: Listing 1.A: HTTP GET-requestHTTP/1.1 200 OKDate: Mon, 06 Dec 1999 20:55:12 GMT Server: Apache/1.3.6 (Linux)Content-length: 82Content-type: text/htmlTest-Seite Test-SeiteThe DIL/NetPCs DNP/1110 Using the Embedded LinuxListing 1.B: HTTP response as result of the GET-request from listing 1.AHTTP 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 ServerSimplified 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 browserThe DIL/NetPCs DNP/1110 Using the Embedded LinuxThe 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 for 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 . 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 picture2.A. Normally these files are stored in the file system of the server. TheWebmaster 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 PagesIn 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).The DIL/NetPCs DNP/1110 Using the Embedded LinuxFor 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-ScriptingPicture 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 LinuxOnce 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 theirThe DIL/NetPCs DNP/1110 Using the Embedded Linuxconfiguration 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 LinuxBut 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 allThe DIL/NetPCs DNP/1110 Using the Embedded Linuxfurther 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.The DIL/NetPCs DNP/1110 Using the Embedded LinuxList of FiguresFigure 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-ScriptingFigure 4: Embedded Web Server Module with StrongARM and LinuxListingsListing 1.A: HTTP GET-requestListing 1.B: HTTP response as result of the GET-request from listing 1.AContactSSV Embedded SystemsHeisterbergallee 72D-30453 HannoverTel. +49-(0)511-40000-0Fax. +49-(0)511-40000-40Email: salesist1.deWeb: www.ssv-embedded.deDocument History (Sadnp05.Doc)Revision DateName1.00 24.05.2002First VersionKDWThis 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.嵌入式系统的网络服务器在“每个人都处在互联网的浪潮中”之后,现在很明显随之而来的是“每件事都处在互联网的浪潮中”。大多数售卖咖啡的机器仍然不能提供全世界的联网。然而嵌入式远程维护和诊断的网络集成就像所谓的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(TCPTransfer Control Protocol, 传输控制协议)。TCP是一个通过下属的IP(IP Internet Protocol, 网际协议)协议传输数据的相对复杂和高质量的协议。TCP本身经过一个广泛的三方握手程序,始终保证两个通信伙伴之间安全的连接。因此经过HTTP的数据传输可以始终被保护。由于广泛的TCP协议机制,HTTP只表现出一种低级别的性能。Figure 1: TCP/IP stack and HTTP programming modelHTTP基于一种简单的客户/服务器的概念。HTTP服务器和客户端经过一个TCP连接进行通信。默认的端口号是80。服务器完全被动地工作。他等待客户端的请求。这种请求通常指明确的HTML文件的传输。这种HTML文件可能不得不由CGI(CGICommon Gateway Interface , 公共网关接口)动态产生。请求的结果,服务器通常将包含的需要的HTML文件通过响应回答(Picture 1.B)。HTTP的请求通常由几行文本组成,通过TCP传送到服务器。Listing 1.A给出了一个例子。第一行表明了请求类型(GET),请求对象(/test1.htm)以及使用HTTP的版本(HTTP/1.1)。请求的第二行客户端告诉服务器能够接收什么类型的文件。第三行包括了关于客户端软件的信息。请求的第四行也是最后一行通知服务器客户端的IP地址。依照请求的类型以及应用的客户端软件可以写出更多行。可以用一个空行作为请求的结尾。GET /test.htm HTTP/1.1Accept: image/gif, image/jpeg, */* User selling agent: Mozilla/4.0Host: Listing 1.A: HTTP GET-r

温馨提示

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

评论

0/150

提交评论