50,549
社区成员
发帖
与我相关
我的任务
分享
Socket client = 创建实例;
InputStream is = client.getInputStream();
DataInputStream dis = new DataInputStream(is);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int len = -1;
while(true){//循环监听服务器端发送来的数据流
while ((len = dis.read(buf, 0, 1024)) != -1) {
baos.write(buf, 0, len);
}
}