Hi!
I have a problem with Bluetooth socket, I hope somebody can help me.
I use the code from BluetoothChat to send and receive data.
I'm trying to receive a file from bluetooth device. This file is sent by
packages of 256 bytes.
My program stuck at mmInStream.read(buffer) in method run() of the class
ConnectedThread after receiving a few packages:
public void run() {
Log.i(TAG, "BEGIN mConnectedThread");
byte[] buffer = new byte[256];
int bytes;
// Keep listening to the InputStream while connected
while (true) {
try {
// Read from the InputStream
bytes = mmInStream.read(buffer);
mEmulatorView.write(buffer, bytes);
} catch (IOException e) {
Log.e(TAG, "disconnected", e);
connectionLost();
break;
}
}
}
Before program blocking I receive different number of packages from 4 to 14.
There is no problem with the connected device, I verify it with Termite on
PC, all packages received.
Is there a buffer somewhere that is filling up? Or another problem with
bluetooth socket inputstream?
Thanks for any help.
--
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