楼主的代码是 按行读取数据,是否服务器也发送了行数据 ,也就是是否有换行符\r\n 之类的。
试试这样读取,按字节流。BufferedInputStream bis = new BufferedInputStream(ins);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
byte[] buffer = new byte[128];
int n = -1;
while ((n = bis.read(buffer)) != -1) {
bos.write(buffer, 0, n);
//这地方可以转换一下数据,分析一下数据是什么。
}
} catch (IOException e) {
e.printStackTrace();
}
试试这样读取,按字节流。BufferedInputStream bis = new BufferedInputStream(ins);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
byte[] buffer = new byte[128];
int n = -1;
while ((n = bis.read(buffer)) != -1) {
bos.write(buffer, 0, n);
//这地方可以转换一下数据,分析一下数据是什么。
}
} catch (IOException e) {
e.printStackTrace();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货