Astreams.write2 problem

derez

Expert
Licensed User
Longtime User
I am using Astreams Prefix to send files and found that when using write2 transmission works only partially and files are not sent fully.
I wrote this code to get over the problem and it works :
B4X:
count = raf.ReadBytes(buffer, 0, Min(8188,SizeM), position)
'AStreams.Write2(buffer,0,count) 'this write2 doesn't work ...
Dim tempbuf(count) As Byte
bc.ArrayCopy(buffer,0,tempbuf,0,count)
AStreams.Write(tempbuf)

Any idea ?

I saw a previous complaint here http://www.basic4ppc.com/forum/bugs-wishlist/19849-something-asyncstreams.html#post114532
 

mc73

Well-Known Member
Licensed User
Longtime User
Checked the java code posted in the thread you linked, I don't see anything wrong, but who knows of course. The user there suggested littleEndian, and I've just check my own aStreams initializations and they are done this way. I don't know, perhaps you could give it a try, if not already done so?
 
Upvote 0

derez

Expert
Licensed User
Longtime User
I work with LittleEndian. If both sides use the same way it works also with True, but I found that my PC program wants LittleEndian (B4ppc).
The problem above is a mystery since it works with write but not with write2, and they should be the same when setting start = 0 and count.
 
Last edited:
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
True, so I noticed. Still, there has to be something somewhere, I just can't accept such notes :)
 
Upvote 0

Similar Threads

Top