VC简易代理服务器的设计(Socket编程)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

VC++简易代理服务器的设计(Socket编程)摘要代理服务器是介于浏览器和Web服务器之间的一台服务器,它的功能是代理网络用户去取得网络信息。它的工作原理是,接收客户机的数据连接请求,并将请求传给Web服务器;再从Web服务器接收返回的数据,最后把数据传给客户端显示。本论文讲述的是关于一个简...p摘 要br/代理服务器是介于浏览器和Web服务器之间的一台服务器,它的功能是代理网络用户去取得网络信息。它的工作原理是,接收客户机的数据连接请求,并将请求传给Web服务器;再从Web服务器接收返回的数据,最后把数据传给客户端显示。本论文讲述的是关于一个简单的代理服务器的实现,在实现中采用客户机/服务器结构模型开发应用程序,基于一般的访问浏览速度慢、效率底、安全功能不强等原因,将以简单、合理、有效为原则;为了方便分析和设计,系统设计中设置不同的状态量用于标识客户机、代理服务器及服务器间的联结状态。在保证系统基本功能的同时,使用多线程机制使得代理系统有更好的延续性。此代理系统具有简单,易用,网络化等优点,能够完成一般的HTTP访问代理服务。br/br/关键词:客户机/服务器结构;多线程;套接字;代理服务器br/ br/TheDesignofSimpleProxyServerbr/Abstractbr/TheproxyserverisaserverwhichsituatesbetweenthebrowserandaWebserver.It’sprincipleofworkis,itreceivestheconnectionrequestfromtheclient,andhandsdowntherequestedtotheWebserver,thenreceivesdatawhichisreturnedfromtheWebserver.,finallyhandsitdownthedatatotheclient.Intherealization,itadoptsClient/Serverstructuralmodeltodevelopapplication.Becauseofbrowsespeedslow,lowefficientandnotsafeenough,ittakessimple,reasonableandeffectiveastheprinciple.Inthesystemdesign,itsetsdifferentstatestoidentifyclient,proxyserverandtheconnectivestatebetweenservers.Whenthesystem'sbasicfunctionareguaranteed,itusethemultithreadingtoenabletheproxyservertohaveabettercontinuousfeature.Thisproxysystemhasthemeritsuchassimple,easytouseandsoon,anditcancompletetheproxyofgeneralHTTPvisit.pclass='Hdx675'/pbr/br/Keywords:Client/Serverarchitecture;Multithreading;Socket;ProxyServerbr/ br/本课题的研究方法br/此代理服务器系统将是建立在WindowsNT平台上的网络应用程序设计。由于需要服务器为其他许多称为客户的主机提供服务,而客户主机又可以随时打开和关闭,在选择网络应用程序体系结构时就采用支持这些特点的客户机/服务器结构。还将运用Windows下网络编程的标准接口WinSock,因为它允许两个或多个应用程序在相同机器上,或者是通过网络相互交流,它是真正协议无关的接口。为了便于直接使用Windows提供的网络编程接口,我们使用MicrosoftVisualC++6.0作为开发工具,利用MFC类库中提供的两个Socket类CAsyncSocket和Csocket。使用这两个Socket类,我们可以运用面向对象的方法来进行Socket编程,而且它们还分别在较低和较高层次上封装了WindowsSocketsAPI,为程序员开发Socket程序提供了便利。spanclass='Hdx675'/span/pbr/br/pbr/目 录br/1   引言   1br/1.1   课题背景   1br/1.2   本课题研究的意义   1br/1.3   本课题的研究方法   1br/2   理论基础   2pclass='Hdx675'/pbr/2.1   代理服务器   2br/2.2   目前的代理服务技术   3br/2.3   SOCKET面向连接的编程模型   4br/2.4   WINSOCK库   5br/2.4.1   winsock的寻址方式   5br/2.4.2   字节顺序   6br/2.5   系统基本套接字调用   6br/2.5.1   创建和关闭套接字-socket()和closesocket()   6br/2.5.2   指定本地地址-bind()   6br/2.5.3   设置监听状态-listen()   6br/2.5.4   建立套接字连接-connect()和accept()   6br/2.5.5   收发数据-send()和recv()   7br/3   设计方案   7br/3.1   基本函数设计   7br/3.2   多线程流程   8pclass='Hdx675'/pbr/4   服务器的实现   8br/4.1   环境创建   8br/4.2   功能实现   9br/4.2.1   数据变量定义   9br/4.2.2   启动代理服务器   10br/4.2.3   请求处理过程   11br/4.2.4   请求响应   13br/4.2.5   关闭服务器   15br/4.2.6   控制主函数   15br/5   测试结果   15br/结   论   17br/参考文献   18br/致   谢   19br/声   明   20pclass='Hdx675'/p/pP/PpAThesisPresentedtotheDepartmentofEnglishCollegeofInternationalStudiesbr/Abstractbr/ManypeoplehaveexpressedtheirappreciationofthecolorfulandattractiveadvertisementthatappearinAmericanmagazines.Theyareattractivenotonlyincoloranddesignbutalsointhelanguagetheyusethatseemssopersuasivethatreadersfindthemselvesunabletoresistthetemptation.Aretheresomespeciallinguistictechniquesthatmaketheseadvertisementssoappealingandeffective?Thisthesisaimsatansweringthisquestionthathasbeenpuzzlingsomanypeople.br/Inthispaper,IwillanalyzeadvertisingEnglishfromsyntacticandlexicalperspectiveanddiscusshowthelanguageisplayedinadvertisingEnglish.MyanalysisanddiscussionarebasedonLeech’swork“Englishinadvertising”,whichisquitecompleteandauthoritativeinthisfield.Butthreedecadeshaspassedsinceleechwrotehisbookandhisstudyconfinedmainlytocommercials.Besidesmystudyismainlyonpressadvertising,sotheremustbesomedifferences.I’vecollectedsomeadvertisementsfromsomeBritishandAmericanmagazinesandnewspaperspublishedintheyearof1999asmysamples.Bothquantitativeandnon-quantitativemethodsareusedinmyanalysis,sinceit’salwaystheintuitionthattellstheinvestigatorswhatarethesignificantcategoriestocountandcontrast.Butoccasionally,t

1 / 16
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功