简单Web服务器设计与实现课程设计(16)

2021-01-20 18:12

计算机网络课设报告,java平台实现,Java;HTTP;Web服务器

iPort = Integer.parseInt(strValue);

}

System.out.println("Web服务器访问端口为:"+iPort);

System.out.println("您可以修改Config.ini文件重新设定以上配置");

System.out.println("启动检查完成,服务器初始化中...");

}

catch (IOException ex)

{

ex.printStackTrace();

}

}

public void start()

{

System.out.println("Web 服务器启动中...");

ServerSocket serverSocket;

try

{

serverSocket = new ServerSocket(iPort);

System.out.println("Web 启动完成!");

System.out.println("您现在可以在浏览器中访问http://localhost:8080/,以测试服务器是否运行");

while (true)

{

Socket socket = null;

InputStream input = null;

OutputStream output = null;

System.out.println("等待连接...");

socket = serverSocket.accept();

System.out.println(socket.getInetAddress().toString()+"请求连接");

input=socket.getInputStream();

output=socket.getOutputStream();

System.out.println("服务器开始处理第"+(++count)+"次连接");

//开始处理并分析请求信息

Request request=new Request(input);

request.parse();

//开始发送请求资源

Response response=new Response(output);

response.setRequest(request);

response.sendStaticResource();

//关系连接

socket.close();

System.out.println("连接已关闭!");


简单Web服务器设计与实现课程设计(16).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2013年中国十大证券公司排行榜

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: