Client.stop() slow

Hi

I’m sending requests to a REST API whenever the user presses a button. This could be once in a few hours or multiple times per second. I’m having issues with the latter case at the moment, since client.stop() seems to take almost 1.5 seconds to return. Why is that?

Hmmmm… It shouldn’t be…

Pretty simple function here:

How did you time it?

I timed it with millis(). Actually I timed within the stop method too and it’s indeed closesocket() that takes so much time.

Seems like a blocking issue with the CC3000

I suspect that since the socket is in blocking mode, it will wait for the whole FIN/ACK sequence to complete on the CC3300 side before it returns. Maybe I can set it to non-blocking just before I close it.