//打开了Tomcat 写了 Demo.html 怎么就没反应呢?
package net;
//自定义ie浏览器
import java.io.*;
import java.net.*;
public class MyIE
{
public static void main(String args[]) throws Exception
{
Socket s=new Socket(InetAddress.getLocalHost(),8080);
PrintWriter pw=new PrintWriter(s.getOutputStream());
pw.println("GET /myweb/Demo.html HTTP/1.1");
pw.println("Accept: */*");
pw.println("Accept-Language: zh-cn");
pw.println("Host: 192.168.1.8:8080");
pw.println("Connection: closed");
pw.println();
pw.println();
BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()));
String line=null;
while((line=in.readLine())!=null)
{
System.out.println(line);
}
s.close();
}
}
|
|