로그로 계속 실시간 확인하고 잇는데 한번만 더 데이터가 넘어오면 파일전송완료되는데 

마지막에 딱 끊겨 버리네요 ㅜㅜㅜㅜ


try{
             BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(mmSocket.getOutputStream()));
             bw.write(file_name+"\n");bw.flush();
            
             DataInputStream dis = new DataInputStream(new FileInputStream(new File(file_path)));
             DataOutputStream dos = new DataOutputStream(mmSocket.getOutputStream());
            
             int b=0;byte buf[]=new byte[4086];
             while((b=dis.read(buf))!=-1){
             dos.write(b);dos.flush();
             Log.d("파일 경로", "경로 ------> "+file_path);
             Log.d("파일 전송중", "파일 보내는중 ------> "+b);
             }
             dis.close();dos.close();
             Log.d("파일 전송", "파일 보내기");
            }catch(IOException ie){
            
            }
-----------------------------------------------------------------------------------------

받는쪽 -----
try {
                    socket = mmServerSocket.accept();
                    Log.d("접속됨", "접속됨");
                    
                    is = socket.getInputStream();
                    br = new BufferedReader(new InputStreamReader(is));
                    
                    
                    String fileName = br.readLine();
                    Log.d("파일이름 전", "파일이름 전");
                    File f = new File("mnt/sdcard/",fileName);
                    Log.d("파일이름 후", "파일이름 후");
                    out = new FileOutputStream(f);
                    Log.d("fileOutputStream", "파일이름 후 FileOutputStream");
                    
                    int i = 0;
                    byte buf[]=new byte[4086];
                    while((i=is.read())!=-1){
                     out.write((char)i);
                     Log.d("받고 있음", "받고있는 중");
                    }
                    Log.d("저장됨", "저장됨");
                    
                } catch (IOException e) {
                    Log.e(TAG, "accept() failed", e);
                    break;
                }catch(Exception e){
                 Log.e("252Error","252Error"+e.toString());
                }finally{
                 try{
                 if(br!=null)br.close();
                 if(is!=null)is.close();
                 if(out!=null)out.close();
                 }catch(IOException e){}
                }