iOS Swift Facing issue on data transfer over CBL2CAPChannel

54 views Asked by At
  1. From central i am able to connect with Peripheral device and able to read the GATT data.
  2. Once peripheral connected i am opening the L2CAPChannel from central, which established successfully(logs i can see in Hercules Simulator).
  3. When i am sending data from central to peripheral(hardware) it's sent successfully.
  4. 2nd time when i am sending data getting SocketStream write error [0x0]: 1 22
  5. 3rd time again when i hit l2CapChannel.outputStream.write it is not call stream delegate method with self.l2capChannel?.outputStream.hasSpaceAvailable false every time.
  6. Also when peripheral (Hardware) send any data to central, my stream delegate method not called.
2

There are 2 answers

0
Jack Farnandish On

I am ble to fix the issue, as i was opening L2CAPChannel on button click, but i did it on didUpdate char**, It's working fine for me.

0
valerauko On

You might need to .open() your streams. It could be that you're closing the output stream after writing the first response and then trying to write it again.