in = new BufferedReader (new InputStreamReader(client.getInputStream()));
out = new DataOutputStream(client.getOutputStream());
ps = new PrintStream(out);
public void run() {
String line;
try {
while ((line = in.readLine()) != null && line.length()>0) {
System.out.println("got header line: " + line);
}
ps.println("HTTP/1.0 200 OK");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ps.println("Content-type: text/html\n\n");
ps.println("<HTML> <HEAD>hello</HEAD> </HTML>");
}
该程序运行没有错误,并且 ps.println 不会向浏览器打印任何内容。知道为什么吗?