无法连接到任何输入和输出流

时间:2017-02-07 10:49:00

标签: java android

 String pass_url = "http://192.168.1.8/eplusv2/android/demo.php";
   try {
     URL url=new URL(pass_url);
       HttpURLConnection con=(HttpURLConnection)url.openConnection();
       con.setRequestMethod("POST");
       InputStream inputStream = con.getInputStream();
       BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"iso-8859-1"));
       String result="";
       String line = "";
       while ((line=bufferedReader.readLine())!= null) {
           result += line;
       }
       inputStream.close();
       bufferedReader.close();
       con.disconnect();


   }catch (Exception e){

   }

我无法使用上述代码连接任何输入或输出流。在调试此代码时,在控制台中我收到消息

D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x40002181, flags=0x0, dataLen=0x9
D/jdwp: sendBufferedRequest : len=0x34

0 个答案:

没有答案