标签:
package netTest; import java.io.*; import java.net.*; public class IE { public static void main(String[] args) throws Exception { Socket s = new Socket("127.0.0.1",8080); PrintWriter out = new PrintWriter(s.getOutputStream(),true); out.println("GET /myweb/demo.html HTTP/1.1"); out.println("Accept: */*"); out.println("Host: 127.0.0.1:11188"); out.println("Connection: keep-Alive"); out.println(); out.println(); BufferedReader bufr = new BufferedReader( new InputStreamReader(s.getInputStream())); String line = null; while((line = bufr.readLine())!=null){ System.out.println(line); } } }
package netTest; import java.io.*; import java.net.*; public class IE { public static void main(String[] args) throws Exception { Socket s = new Socket("127.0.0.1",8080); PrintWriter out = new PrintWriter(s.getOutputStream(),true); out.println("GET /myweb/demo.html HTTP/1.1"); out.println("Accept: */*"); out.println("Host: 127.0.0.1:11188"); out.println("Connection: keep-Alive"); out.println(); out.println(); BufferedReader bufr = new BufferedReader( new InputStreamReader(s.getInputStream())); String line = null; while((line = bufr.readLine())!=null){ System.out.println(line); } } }
网络编程(自定义图形界面浏览器-Tomcat服务端). 模拟IE 的请求
标签:
原文地址:http://www.cnblogs.com/yangyongqian/p/5150460.html