I am having huge troubles trying to send larger amounts of data (> 60kB) over a SSL socket.
The center of the problem is the
qapi_Net_SSL_Write function. Calling it is a nonblocking operation so I have no idea when the data is actually transferred and the ssl socket is ready for the next write call.
I have to call it multiple times in a row to send a large file (4MB) in small fragments but this is impossible because sometimes I get -20012 errors or the server reports a failed hashsum.
Only the first few calls to qapi_Net_SSL_Write work so I am able to send smaller files correctly but the call fails sporadically after 4 or 5 calls in a row. I am writing 16kB buffers each time.
qapi_Timer_Sleep between writes works but it is an unacceptable solution because we do not know how long to wait and upload speeds are unoptimal.
I tried to use
qapi_select to wait for the write socket to be ready but it also immediately returns without any indication that the underlying socket has actually sent the data.
I tried to set the socket option
SO_NONBLOCK but it had no effect.
I need help for this topic otherwise we are unable to upload larger files with the BG95.
Thanks and regards
I was able to find a solution by polling the SO_TXDATA option to check if the socket send buffer has enough space. Doing it this way works.