I’ve got a working implementation of what I call a SocketDispatcher, essentially a dedicated task that handles all network communication for all non-blocking sockets via select() calls, and subsequently calls readable and writable events on the respective sockets wrapper classes.
I’m now trying to add support for TLS using mbed TLS, but have ended up in a state where:
- Handshake succeeds mbedtls_ssl_handshake() returns 0
- One application payload is sent
- One application payload is received.
- Trying to send a second payload fails.
From reading the log output from mbedTLS (which I unfortunately don’t have access to right now) it seems it’s wanting to read five bytes, but they never arrive and the other end eventually close the connection.
The most relevant parts of my implementation is available here
My main questions, other than that I would appreciate another set of eyes on my code, is if there are any problems with working with mbedTLS in the way I do, i.e. using FD_ISSET() to determine when calling mbedtls_sslread/write?
Edit: Sorry, I realize I haven’t pushed the current version to GitHub and can’t do that until this evening. The question remains though.