This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Socket error when attempting to send large TCP payload

Hello,

I am trying to send a rather large HTTP payload from the nRF9160, the payload is about 10KB in size. The problem I am running into is that after about ~4KB of data sent successfully through the socket send() function, the send() function will error out, returning -1.

I have done my research on this issue and discovered the following tickets related to my current problem:

The problem is that it is still unclear whether or not what I would like to do is going to be possible.
In ticket #2 above, jbrzozoski mentions that you can split up the payload into smaller chunks and as long as you can hold the entire payload in RAM, you should be fine (10KB). Unfortunately, this does not appear to be the case - I tried splitting the payload up in to various sizes (512/1024/2048) and the socket send() will always return an error after about 4KB of data has been sent through the socket. It was also suggested in ticket #1 above to add a sleep in between socket send() calls (~200ms), and in doing so it looks like he was successful in sending a large payload. Unfortunately, this workaround did not work for me either.
I know from ticket #4 and from previous issues related to trying to store SSL certificates larger than 4KB that the bsdlib socket buffer is defined at 4096. It feels like the buffer is filling up and capping at 4096 even though I am sending the data in smaller chunks.

Can you advise on the issues that I am seeing here?
Thanks,
Cody
Parents
  • What is the value of errno after send() errors out?  And what version of modem firmware and BSDLIB are you using?  For the BSDLIB version, see what git commit your nrfxlib directory is checked out at.

    Oversize TCP send behavior has been tweaked in recent versions of both, which is why I ask.  There may still be a bug, but you should confirm that you're on the newer versions first.

Reply
  • What is the value of errno after send() errors out?  And what version of modem firmware and BSDLIB are you using?  For the BSDLIB version, see what git commit your nrfxlib directory is checked out at.

    Oversize TCP send behavior has been tweaked in recent versions of both, which is why I ask.  There may still be a bug, but you should confirm that you're on the newer versions first.

Children
  • Thank you for your response, meant to get back to you sooner but I have been heads down working on a release.

    I have no idea what I did or what changed but it appears to be working now. It is possible that there could have been an issue elsewhere in the code. Just in case you were still curious, I was working off the officially released and tagged v1.2.0 version of the nRF Connect SDK.

Related