简易代理服务器的设计
摘 要
代理服务器是介于浏览器和Web服务器之间的一台服务器,它的功能是代理网络用户去取得网络信息。它的工作原理是,接收客户机的数据连接请求,并将请求传给Web服务器;再从Web服务器接收返回的数据,最后把数据传给客户端显示。本论文讲述的是关于一个简单的代理服务器的实现,在实现中采用客户机/服务器结构模型开发应用程序,基于一般的访问浏览速度慢、效率底、安全功能不强等原因,将以简单、合理、有效为原则;为了方便分析和设计,系统设计中设置不同的状态量用于标识客户机、代理服务器及服务器间的联结状态。在保证系统基本功能的同时,使用多线程机制使得代理系统有更好的延续性。此代理系统具有简单,易用,网络化等优点,能够完成一般的HTTP访问代理服务。
关键词:客户机/服务器结构;多线程;套接字;代理服务器
The Design of Simple Proxy Server
Abstract
The proxy server is a server which situates between the browser and a Web server. It’s principle of work is, it receives the connection request from the client, and hands down the requested to the Web server, then receives data which is returned from the Web server., finally hands it down the data to the client. In the realization, it adopts Client/Server structural model to develop application. Because of browse speed slow, low efficient and not safe enough, it takes simple, reasonable and effective as the principle. In the system design, it sets different states to identify client, proxy server and the connective state between servers. When the system's basic function are guaranteed, it use the multithreading to enable the proxy server to have a better continuous feature. This proxy system has the merit such as simple, easy to use and so on, and it can complete the proxy of general HTTP visit.
Key words: Client / Server architecture;Multithreading;Socket;Proxy Server