Trouble receiving binary stream data with recv()

I've been writing this FOTA solution that would work together with an existing server we use together with Onomondo connectors.

And I've been running into this issue when I'm trying to download a firmware bin file, when I try to use the recv function to retrieve the data, I'll get a few bytes that make sense, the starter byte for example, and then in between there's a loop of `239 191 189` bytes just repeating hundreds of times.

When I've tested the output from the server through Postman or just by URL, it appears to work correctly and returns the file. I am however able to return the bytes in a string format and then convert them on the device, although it's a very slow operation.

I've also setup logging on the server to verify the data that's supposedly being returned to the nrf9160, and that also appears to be correct?

  • It is in fact the same app_update.bin, the first 4 bytes when you compile the firmware in a sort of identifier, so 3D B8 F3 96 is an ID for MCUBoot Application Image, so I think even if the app_update.bin were different it should still start with that.

    I tried every single encoding type that the express server supported and none of them worked, but I have been in touch with Onomondo's support, and although they don't think they're the cause of the issue either, I tried disabling the connector and just using regular HTTP/s requests and that actually works as expected!

    So for now I'll just have to use regular requests and avoid the connector system when sending binary data. 

    Thank you for the support!

Related