外文翻译--Linux_server翻译嵌入式系统的网络服务器 英文版.doc
北京工业大学毕业设计(译文)-7-TheDIL/NetPCsDNP/1110UsingtheEmbeddedLinuxWebServerforEmbeddedSystemsAfterthe“everybody-in-the-Internet-wave”nowobviouslyfollowsthe“everything-in-the-Internet-wave”.Themostcoffee,vendingandwashingmachinesarestillnotavailableabouttheworldwidenet.HowevertheembeddedInternetintegrationforremotemaintenanceanddiagnosticaswellastheso-calledM2Mcommunicationisgrowingwithaconsiderablespeedrate.JusttheremotemaintenanceanddiagnosticofcomponentsandsystemsbyWebbrowsersviatheInternet,oralocalIntranethasaveryhighweightformanydevelopmentprojects.InnumerousdevelopmentdepartmentspeopleworkoncompletelyWebbasedconfigurationsandservicesforembeddedsystems.TheremainingdaysoftheclassicuserinterfacemadebyasmallLC-displaywithfrontpanelandafewfunctionkeysareover.ThroughfutureevolutionsinthefieldofthemobileInternet,Bluetooth-basedPANs(PersonalAreaNetworks)andtherapidlygrowingM2Mcommunication(M2M=Machine-to-Machine)afurtherinnovatingadvanceistobeexpected.ThecentralfunctionunittogetaccessonanembeddedsystemviaWebbrowseristheWebserver.SuchWebserversbringthedesiredHTMLpages(HTML=HyperTextMarkupLanguage)andpicturesovertheworldwideInternetoralocalnetworktotheWebbrowser.ThishappensHTTP-based(HyperTextTransferProtocol).ATCP/IPprotocolstackthatmeansitisbasedonsophisticatedandestablishedstandardsmanagestheentirecommunication.Webserver(HTTPserver)andbrowser(HTTPclient)buildTCP/IP-applications.HTTPachievedaphenomenaldistributioninthelastyears.MeanwhilemillionsofuseraroundtheworldsurfHTTP-basedintheWorldWideWeb.Todayalmosteverypersonalcomputeroffersthenecessaryassistanceforthisprotocol.Thisstatusisvalidmoreandmoreforembeddedsystemsalso.TheHTTPspreadsupwithafastratetoo.北京工业大学毕业设计(译文)8TheDIL/NetPCsDNP/1110UsingtheEmbeddedLinux1.TCP/IP-basedHTTPasCommunicationPlatformHTTPisasimpleprotocolthatisbasedonaTCP/IPprotocolstack(picture1.A).HTTPusesTCP(TransmissionControlProtocol).TCPisarelativecomplexandhigh-qualityprotocoltotransferdatabythesubordinateIPprotocol.TCPitselfalwaysguaranteesasafeguardedconnectionbetweentwocommunicationpartnersbasedonanextensivethree-way-handshakeprocedure.AsaresultthedatatransferviaHTTPisalwaysprotected.DuetotheextensiveTCPprotocolmechanismsHTTPoffersonlyalow-gradeperformance.Figure1:TCP/IPstackandHTTPprogrammingmodelHTTPisbasedonasimpleclient/server-concept.HTTPserverandclientcommunicateviaaTCPconnection.AsdefaultTCPportvaluetheportnumber80willbeused.Theserverworkscompletelypassive.Hewaitsforarequest(order)ofaclient.ThisrequestnormallyreferstothetransmitionofspecificHTMLdocuments.ThisHTMLdocumentspossiblyhavetobegenerateddynamicallybyCGI.Asresultoftherequests,theserverwillanswerwitharesponsethatusuallycontainsthedesiredHTMLdocumentsamongothers(picture1.B).GET/test.htmHTTP/1.1Accept:image/gif,image/jpeg,*/*Usersellingagent:Mozilla/4.0Host:192.168.0.1Listing1.A:HTTPGET-requestHTTP/1.1200OKDate:Mon,06Dec199920:55:12GMTServer:Apache/1.3.6(Linux)Content-length:82Content-type:text/html<html><head><title>Test-Seite</title></head><body>Test-Seite北京工业大学毕业设计(译文)9TheDIL/NetPCsDNP/1110UsingtheEmbeddedLinux</body></html>Listing1.B:HTTPresponseasresultoftheGET-requestfromlisting1.AHTTPrequestsnormallyconsistofseveraltextlines,whicharetransmittedtotheserverbyTCP.Thelisting1.Ashowsanexample.Thefirstlinecharacterizestherequesttype(GET),therequestedobject(/test1.htm)andtheusedHTTPversion(HTTP/1.1).Inthesecondrequestlinetheclienttellstheserver,whichkindoffilesitisabletoevaluate.Thethirdlineincludesinformationabouttheclient-software.Thefourthandlastlineoftherequestfromlisting1.AisusedtoinformtheserverabouttheIPaddressoftheclient.Inaccordingtothetypeofrequestandtheusedclientsoftwaretherecouldfollowsomefurtherlines.Asanendoftherequestablanklineisexpected.TheHTTPresponsesasrequestanswermostlyconsistoftwoparts.Atfirstthereisaheaderofindividuallinesoftext.Thenfollowsacontentobject(optional).ThiscontentobjectmaybeconsistsofsometextlinesincaseofaHTMLfileorabinaryfilewhenaGIForJPEGimageshouldbetransferred.Thefirstlineoftheheaderisespeciallyimportant.Itworksasstatusorerrormessage.Ifanerroroccurs,onlytheheaderorapartofitwillbetransmittedasanswer.2.FunctionalprincipleofaWebServerSimplifiedaWebservercanbeimaginedlikeaspecialkindofafileserver.Picture2.Ashowsanoverview.TheWebserverreceivesaHTTPGET-requestfromtheWebbrowser.Bythisrequest,aspecificfileisrequiredasanswer(seestep1intopicture2.A).Afterthat,theWebservertriestogetaccessonthefilesystemoftherequestedcomputer.Thenitattemptstofindthedesiredfile(step2).AfterthesuccessfulsearchtheWebserverreadtheentirefile(step3)andtransmititasananswer(HTTPresponsecomprisingofheaderandcontentobject)totheWebbrowser(step4).IftheWebservercannotfindtheappropriatefileinthefilesystem,anerrormessage(HTTPresponsewhichonlycontainstheheader)issimplybesendasresponsetotheclient.Figure2:FunctionalprinciplefromWebserverandbrowser北京工业大学毕业设计(译文)10TheDIL/NetPCsDNP/1110UsingtheEmbeddedLinuxThewebcontentisbuildbyindividualfiles.ThebaseisbuildbystaticfileswithHTMLpages.WithinsuchHTMLfilestherearereferencestofurtherfilesembeddedthesefilesaretypicallypicturesinGIForJPEGformat.However,alsoreferencestootherobjects,forexampleJava-Applets,arepossible.AfteraWebbrowserhasreceivedaHTMLfileofaWebserver,thisfilewillbeevaluatedandthensearchedforexternalreferences.Nowthesteps1to4frompicture2.AwillrunagainforeveryexternalreferenceinordertorequesttherespectivefilefromthecorrespondingWebserver.Pleasenote,thatsuchareferenceconsistsofthenameorIPaddressofaWebserver(e.g."dilnetpc.com"),aswellasthenameofthedesiredfile(e.g."picture1.gif").SovirtuallyeveryreferencecanrefertoanotherWebserver.Inotherwords,aHTMLfilecouldbelocatedontheserver"ssv-embedded.de"buttherequiredpicture-whichisexternalreferencedbythisHTMLfile-islocatedontheWebserver"dilnetpc.com".Finallythis(worldwide)networkingofseparateobjectsisthecauseforthenameWorldWideWeb(WWW).Allfiles,whicharerequiredbyaWebserver,arerequestedfromabrowserliketheprocedureshownonpicture2.A.Normallythesefilesarestoredinthefilesystemoftheserver.TheWebmasterhastoupdatethesefilesfromtimetotime.AfurtherelementaryfunctionalityofaWebserveristheCommonGatewayInterface(CGI)-wehavementionedbefore.Originallythistechnologyismadeonlyforsimpleforms,whichareembeddedintoHTMLpages.Thedata,resultingfromthepaddingofaform,willbetransmittedtoaWebserverviaHTTP-GETorPOST-request(seestep1intopicture2.B).InsuchaGET-orPOST-requestthenameoftheCGIprogram,whichisneededfortheevaluationofaform,isfundamentallyincluded.ThisprogramhastobeontheWebserver.Normallythedirectory"/cgi-bin"isusedasstoragelocation.AsresultoftheGET-orPOST-requesttheWebserverstartstheCGIprogramlocatedinthesubdirectory"/cgi-bin"anddeliversthereceiveddatainformofparameters(step2).TheoutputsofaCGIprogramareguidedtotheWebserver(step3).ThentheWebserversendsthemallasresponsestotheWebbrowser(step4).3.DynamicgeneratedHTMLPagesIncontradictiontoacompanyWebsiteserver,whichinformspeopleabouttheproductprogramandservicesbystaticpagesandpictures,anembeddedWebserverhastosupplydynamicallygeneratedcontents.TheembeddedWebserverwillgeneratethedynamicpagesinthemomentofthefirstaccessbyabrowser.HowelsecouldwechecktheactualtemperatureofasystemviaInternet?StaticHTMLfilesarenotinterestingforanembeddedWebserver.ThemostinformationaboutthefirmwareversionandserviceinstructionsarestoredinHTMLformat.AllothertasksarenormallymadeviadynamicgeneratedHTML.TherearetwodifferenttechnologiestogenerateaspecificHTMLpageinthemomentoftherequest:Firsttheso-calledserver-side-scriptingandsecondtheCGIprogramming.Attheserver-side-scripting,scriptcodeisembeddedintoaHTMLpage.Ifrequired,thiscodewillbecarriedoutontheserver(server-sided).