this is a code for sending data streaming for file transfer.

sender :

File myFile = new File(message.toURI());
        nosofpackets=Math.ceil(( (int)myFile.length())/4096);
        //mChatService.writeda(message.getName(), myFile.length());
        for(double i=0; i<nosofpackets; i++)
        {
            BufferedInputStream bis = new BufferedInputStream(new
FileInputStream(myFile));
            byte[] send = new byte[4096];
            bis.read(send, 0,send.length);
            mChatService.write(send);
        }

receiver code as follows.
receiver:

Log.d(TAG, "begin inputstream");
                        bytes = mmInStream.read(buffer);
                        Log.d(TAG, "data incoming");
                        System.out.println(bytes);
                        Log.d(TAG, "begin file writing");
                        //bos.write(buffer, 0,buffer.length);
                        while((bytes = mmInStream.read(buffer))>0){
                            Log.d(TAG, "data is there for writing");
                            bos.write(buffer);}

i am getting a prob ..i.e when i am send data from one cell to another
..the receiver file is getting too large and corrupted.plz help me.
its not working properly.
thankyou

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to