7 years, 6 months ago.

K64F retrieving file over HTTPS triggers multiple read interrupts

I'm in the process of adapting mbed-tls-sockets to be able to retrieve .bin files of a webserver, I'm currently building the files using a yotta docker image.

The binary file that I'm trying to retrieve is 20.4 kb.

I'm initiating a handler according to the example.

s->setOnReadable(Socket::ReadableHandler_t(this, &HelloHTTPS::onReceive));

And after setting up a connection with the server, and sending my data, onReceive triggers multiple times.

I tried to increase the size of the _buffer in main.cpp, and the size of the IO buffer in ssl.h.

main.cpp

    char _buffer[RECV_BUFFER_SIZE]; /**< The response buffer */

ssl.h

#define MBEDTLS_SSL_MAX_CONTENT_LEN         16384   /**< Size of the input / output buffer */

This did change the behaviour, where onReceive triggered less often when the buffers were bigger. Unfortunately it seems that the processor is too fast where it thinks a receive is over, or that some buffer is getting filled before the actual receiving of data is completed. I spend a huge chunk of my day altering settings and adjusting configurations, only the end result was the same.

I also tried to adjust the size of pbuf, or the HEAP allocation size:

/**
 * MEM_SIZE: the size of the heap memory. If the application will send
 * a lot of data that needs to be copied, this should be set high.
 */
#if !defined MEM_SIZE || defined __DOXYGEN__
#define MEM_SIZE                        1600
#endif

Whatever I do, onReceive in main.cpp keeps triggering multiple times. I was wondering if anyone has some tips for me, something that I might be missing.

I'd open an issue against https://github.com/ARMmbed/mbed-tls-sockets and mention @pjbakker there...

posted by Jan Jongboom 04 Oct 2016

I couldnt delete this post, otherwise I would have deleted it, I also posted it on the newer more active forum, where I explained more about my problem and what I did to resolve it. I don't think its necessarily a bug, probably more something I don't understand.

https://forums.mbed.com/t/k64f-retrieving-file-over-https-triggers-multiple-read-interrupts/1914

posted by Confususs . 04 Oct 2016
Be the first to answer this question.