用Java实现Web服务器

所属分类:Web服务器
开发工具:Java
文件大小:10KB
下载次数:176
上传日期:2005-11-27 12:00:04
上 传 者panyy83
说明:  用Java实现Web服务器 本文实现了GET请求的Web服务器程序的方法,通过创建ServerSocket类对象,监听端口8080; 等待、接受客户机连接到端口8080; 创建与socket字相关联的输入流和输出流 然后,读取客户机的请求信息,若请求类型是GET,则从请求信息中获取所访问的HTML文件名,如果HTML文件存在,则打开HTML文件,把HTTP头信息和HTML文件内容通过socket传回给Web浏览器,然后关闭文件。否则发送错误信息给Web浏览器。最后,关闭与相应Web浏览器连接的socket字。
(Java Web server is to achieve a GET request to the Web server, through the creation of ServerSocket class object, bugging port 8080; Wait, a client is connected to port 8080; Socket character creation and the associated input and output streams flow then read the client's request information, if the request is the type of GET, request information from being accessed visit HTML document, and if the HTML document exists, then open the HTML file, HTTP headers and HTML files through the socket sent back to the Web browser and then close the file. Otherwise, send the wrong message to the Web browser. Finally, the closing and the corresponding Web browser connected to the socket word.)

文件列表:
用Java实现Web服务器\WebServer.java (780, 2005-06-08)
用Java实现Web服务器\webServer1.java (1549, 2005-06-09)
用Java实现Web服务器\用Java实现Web服务器.doc (42496, 2005-11-27)
用Java实现Web服务器 (0, 2005-11-27)
用Java实现Web服务器\index.html (257, 2005-06-08)

近期下载者

相关文件


收藏者