Socket recv returning -122 (nrf9160)

I'm trying to receive an HTTP response of approximately 100KB using the nrf9160 modem.  When the response size is small recv works fine.  When response is large recv returns negative with 122 in errno (EMSGSIZE).  This value appears to be returned directly from nrf_modem_lib (which I don't have the source to) and the return value is not documented anywhere as far as I can tell.  The download_client and https_client samples work fine for ~100KB of data and recv appears to be working as expected.  I can't for the life of me determine what I'm doing differently from those samples - I'm using the same prj.conf settings, and am following the same procedure for creating and connecting the socket.  Any idea what I might be doing wrong?  Thank you, Erin H

  • In all my testing it appears the only combination of TLS + large response that worked is the download client sample with the default https file provided.  The modem seems to have a 2KB response limit (when TLS is enabled - the limit without TLS appears to be much higher), and the server needs to honor a header field that requests only ~2KB ranges of the target file at once when TLS is enabled.  And if the server doesn't support this header field (for e.g. a long json response and not a file) the modem is incapable of receiving the response with TLS

Related