对着书写的一个创建HTTPSCilent的简单程序Writer out = new OutputStreamWriter(socket.getOutputStream(),"UTF-8");
out.write("GET http://"+host+"/HTTP/1.1\r\n");
out.write("Host"+host+"\r\n");
out.write("\r\n");
out.flush();
BufferedReader in =new BufferedReader(new InputStreamReader(socket.getInputStream()));
String s;
while (!(s = in.readLine()).equals("")){//这一行出异常java.lang.NullPointerException
System.out.println(s);
}
System.out.println();搞不懂这个为什么啊,我传入的参数www.baidu.com,完整程序有点多,有必要再传。。。
添加回答
举报
0/150
提交
取消