1

I am trying to write the continuous data from bluetoothclient(C# NetworkStream) to Android client (BluetoothSocket). But I observed that C# write is getting blocked , while trying to read data from Android bluetooth socket.This block is not observed if I am not trying to read data from client. Tried using BufferedStream for writing , but still I see the same issue.

C# Bluetooth server Code :

NetworkStream _st = _clnt.GetStream();
while(true){
   _st.Write(_serData, 0, _serData.Length);
   // Required delay is given before writing next chunk
}

Android Bluetooth reader :

InputStream inputstream = btSocket.getInputStream()
while(true){
 int len = inputstream.read(buffer, offset, buffer.length);
 offset += len;
}
MGK
  • 7,050
  • 6
  • 34
  • 41

1 Answers1

0

Solved this issue by sending keep-ALive packets from ANdroid client side , solved my problem as suggested in

Application using bluetooth SPP profile not working after update from Android 4.2 to Android 4.3

Community
  • 1
  • 1
MGK
  • 7,050
  • 6
  • 34
  • 41