标签:
package com.mytomcat; import java.net.*; import java.io.*; public class Mytomcat { public static void main(String[] args)throws Exception { ServerSocket s = new ServerSocket(9988); System.out.println("waiting...."); Socket s1 = s.accept(); OutputStream os = s1.getOutputStream(); BufferedReader br = new BufferedReader(new FileReader("F:\\hello.html")); String buf = ""; while((buf=br.readLine())!=null) { os.write(buf.getBytes()); } br.close(); os.close(); s.close(); }
java servlet----模拟一个简单的tomcat服务器
标签:
原文地址:http://blog.csdn.net/a879365197/article/details/46419119