输入的参数为:http://192.168.1.173:8080/Api/petinfo/petinfo?flag=adopt&json=[{"pettype":"100","petname":"ge"}]
public static InputStream getInputStreamFromUrl(String urlstr){
try {
InputStream is = null;
HttpURLConnection conn = null;
System.out.println("urlstr:"+urlstr);
URL url = new URL(urlstr);
conn = (HttpURLConnection) url.openConnection();
if (conn.getResponseCode() == 200) {
is = conn.getInputStream();
return is;
}
} catch (Exception e) {
System.out.println(e.toString());
}
return null;
}
返回异常:
09-16 09:32:58.892: I/System.out(416): java.io.IOException: Malformed ipv6 address: [192.168.1.173:8080]但是我用模拟器上的浏览器输入该网站是能正常访问的。
这是什么原因呢?