While using Streamconnection my phone keeps crashing if i try to send more than 1024bytes of data.
Is there a known issue as to why?
I can provide more info if it is needed,
thanks for your help
While using Streamconnection my phone keeps crashing if i try to send more than 1024bytes of data.
Is there a known issue as to why?
I can provide more info if it is needed,
thanks for your help
You didn't supply much information about how you implemented the data receiving, so I'm going to take a wild guess:
Are you are reading the data using InputStream.read(byte[],int,int) or InputStream.read(byte[])?
If you are then you have to make sure you are actually reading all the data. Even if the byte array you pass to these methods is big enough for all the data, the methods don't guarantee that all the data will be read in one go. They return the number of bytes read, so you have to check this number, compare it to the total amount of data you are expecting and keep on reading if necessary. Another option is to use DataInputStream.readFully(byte[]).
shmoove