日期:2014-05-20 浏览次数:20632 次
DataOutputStream daOutStream=new DataOutputStream(socket.getOutputStream()); daOutStream.write(字节数据); daOutStream.flush();
DataInputStream daInStream=new DataInputStream(socket.getInputStream()); ByteArrayOutputStream baOutputStream=new ByteArrayOutputStream(1024); while(true){ byte[] buffer=new byte[1024]; int total=0; total=daInStream.read(buffer); while((total=daInStream.read(buffer))!=-1 ){ baOutputStream.write(buffer, 0, total); } }