socket接收输入流时,不能检测到流的末尾,该怎么解决

socket接收输入流时,不能检测到流的末尾我的程序要实现多个文件的连续传输,不知道是否因为输入流没有关闭

socket接收输入流时,不能检测到流的末尾
我的程序要实现多个文件的连续传输,不知道是否因为输入流没有关闭的原因,接收端无法检测到流的末尾,所以之一阻塞,希望高手帮忙解决。

接收端:
while((len=bis.read(buf,0,1024*10))!=-1)
{
    bos.write(buf,0,len);
    bos.flush();
    System.out.println(len);
}
System.out.println( "end ");
bos.close();
fos.close();
os.write(1);

输出信息:
creating   outside\a.doc......
fileLen:   24064
10240
10240
3584

发送端:
while((len=bis.read(fileBuf,0,1024*10))!=-1)
{
    bos.write(fileBuf,0,len);
    bos.flush();
  }    
    bis.close();
    fis.close();
    System.out.println( "file   end ");
    is.read();

输出信息:
file   end

[解决办法]
帮你up,不用给我分。
: )

你这个做的是文件传送吗?
[解决办法]
发送端没有关闭流,接受端当然收不到结束标志。
发送端:
while((len=bis.read(fileBuf,0,1024*10))!=-1)
{
bos.write(fileBuf,0,len);
bos.flush();
}
===========================
bos.close();
===========================
bis.close();
fis.close();
System.out.println( "file end ");
is.read();