详细说明:采用Socket和多线程技术,实现一个java Web服务器,加深对HTTP的认识。 新建java项目 webServer 新建java文件 WebServer.java Processor.java 一、HTTP协议的作用原理 WWW是以Internet作为传输媒介的一个应用系统,WWW网上最基本的传输单位是Web网页。WWW的工作基于客户机/服务器计算模型, 由Web 浏览器(客户机)和Web服务器(服务器)构成,两者之间采用超文本传送协议(HTTP)进行通信。HTTP协议是基于TCP/IP协议之上的协议,是 Web浏览器和Web服务器之间的应用层协议,是通用的、无状态的、面向对象的协议。HTTP协议的作用原理包括四个步骤: (1) 连接:Web浏览器与Web服务器建立连接,打开一个称为socket(套接字)的虚拟文件,此文件的建立标志着连接建立成功。 (2) 请求:Web浏览器通过socket向Web服务器提交请求。HTTP的请求一般是GET或POST命令(POST用于FORM参数的传递)。GET命令的格式为: GET 路径/文件名 HTTP/1.0 文件名指出所访问的文件,HTTP/1.0指出Web浏览器使用的HTTP版本。 (3) 应答:Web浏览器提交请求后,通过HTTP协议传送给Web服务器。Web服务器接到后,进行事务处理,处理结果又通过HTTP传回给Web浏览器,从而在Web浏览器上显示出所请求的页面-Socket and uses multi-thread technology to achieve a java Web server, HTTP deepen understanding. New projects webServer java java file WebServer.java Processor.java a new role of the HTTP protocol principle WWW Internet as an application system based on the transmission medium, WWW Internet basic transmission unit is a Web page. The calculation is based on the work of WWW client/server model, the Web browser (client) and Web server (server) structure, using Hypertext Transfer Protocol (HTTP) to communicate between the two. HTTP protocol is the protocol TCP/IP protocol based upon, is an application layer protocol between the Web browser and the Web server, is generic, stateless, object-oriented protocol. Action principle HTTP protocol consists of four steps: (1) connection: Web browser to establish a connection with a Web server, open a virtual file called socket (socket), the establishment of this document marks the connection is established. (2) Request: Web browser through the socket
java socket 浏览器_javaweb 采用Socket和多线程技术,实现一个 Web服务器,加深对HTTP的认识。 新建 项目 Win -NDIS 网络编程 238万源代码下载- www.p...
最新推荐文章于 2023-03-28 09:49:22 发布