On 27/05/16 07:32, counterpoint wrote: > Hmm, some progress, but still puzzled. When my code is acting as the client, > it seems that the problem can be overcome by calling SSL_set_read_ahead with > a zero parameter, to turn off reading ahead. This is done just before > calling SSL_connect. The application now seems able to read megabytes of > data from the server without hanging. read_ahead and SSL_pending() do not play nicely together unfortunately. See the master (1.1.0) version of the SSL_pending() documentation which discusses this issue and introduced the new function SSL_has_pending() which addresses it: https://www.openssl.org/docs/manmaster/ssl/SSL_pending.html > > However, adding a similar call just before SSL_accept does not solve the > problem when the application is the server, and is reading a lot of data > from the client. It looks as if the data is read (certainly hundreds of KB > in packets of 16384 bytes) but the application then hangs. Presumably for > lack of any trigger (such as EPOLLIN) to generate any further activity. So it sounds like this is during reading of application data? Has SSL_accept() returned successfully, and you are now wanting to call SSL_read()? Matt