connectivity-samples icon indicating copy to clipboard operation
connectivity-samples copied to clipboard

Nearby Connections API sendPayload as stream stops in the middle of stream

Open patrick-ucr opened this issue 5 years ago • 2 comments

Dear All,

I am using Nearby Connections to transmit and receive data between two Pixel 2 phones and follow guideline in the formal page ..

My input is a byte array of Y plane from the camera frame of size 300KB. Then I convert it to InputStream using InputStream yStream = new ByteArrayInputStream(yBytesArray); and send this stream as payload.

When I log update in onPayloadTransferUpdate(), I see that the sender stops sending when ~150KB are sent. Also, the receiver only gets ~50KB and then stops, without returning the state "SUCCESS".

I have tried changing strategy to STAR and POINT_TO_POINT but it doesn't help. Anyone has any idea how I can fix this. Thank you.

Patrick

patrick-ucr avatar Mar 04 '20 05:03 patrick-ucr

I observed that after sending 157080 bytes (number from update.getBytesTransferred ()), the Nearby connection gets disconnected. From the same transmission, the receiver receives only 59136 bytes (number from the same method call).

patrick-ucr avatar Mar 07 '20 22:03 patrick-ucr

After I make InputStream yStream a global parameter, I can have the sender send the entire byte array. However, the receiver still is able to receive only 59,136 bytes. I would appreciate any advice on this.

patrick-ucr avatar Mar 08 '20 23:03 patrick-ucr