Hello !
First, sorry but my english is bad ^^ !
I'm develloping an app for android.
I use a function (see below) for transfert a file on the network.
____________________________________________
private void fromTo(InputStream in, OutputStream out, int offset, long
length){
try{
byte[] buffer = new byte[buffer_size];
long total = 0;
while(total <= length+offset-buffer_size){
in.read(buffer);
out.write(buffer);
total+=buffer_size;
}
int end = ((int)(length-total))+offset;
in.read(buffer, 0, end);
out.write(buffer, 0, end);
}
catch(Exception e){}
}
_______________________________________
NB:i've removed some code...
Two situation:
-S1: in is get from a socket and out is a locale file
-S2: in is the local file and out is get from a socket
Well !
S1 and S2 work on the emulator.
But, on a real device, S1 make some problem.
The file is mixed :/ !
For exemple i would to tranfert this text:
"123456789ABCDEF
123456789ABCDEF
123456789ABCDEF
123456789ABCDEF
123456789ABCDEF
123456789ABCDEF
123456789ABCDEF"
But i receive this:
"123456789ABCDEF
12345678923456789ABCDEF
123456789ABCDEF
123456789ABCDEF
12345678ABCDEF
123456789ABCDEF
123456789ABCDEF
123456789"
(not realy a real exemple)
The content received have same size as the source.
Look at this:
"123456789ABCDEF" is send and "12345678ABCDEF" is received :/ !
How does it is possible ?
Someone can help me ?
Thank in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---