class MyIE
{
public static void main(String[] args) throws Exception
{
Socket s = new Socket("169.254.68.202",8080);
PrintWriter out = new PrintWriter(s.getOutputStream(),true);
out.println("GET /html/index.html HTTP/1.1");
out.println("Accept: */*");
out.println("Accept-Language: zh-cn");
out.println("Host: 169.254.68.202:11000");
out.println("Connection: closed");
out.println();
out.println();
BufferedReader bufIn = new BufferedReader(new InputStreamReader(s.getInputStream()));
String line = null;
while ((line = bufIn.readLine())!=null)
{
System.out.println(line);
}
s.close();
}
}
这个代码在命令行运行可以打印出网页内容,为什么在MyEclipse中运行却打印不出来呢?请帮忙分析一下。
|
|