[openssl-users] The server's "SSL_write" freezes if invoked while client disconnects

Newcomer83 at web.de Newcomer83 at web.de
Wed Sep 23 16:02:26 UTC 2015

Hello everyone,

I have an OpenSSL client (Windows) and server (Ubuntu). When my client tries to disconnect from the server, but the server happens to call SSL_write during the disconnect process by chance, then SSL_write freezes. I tried to check the socket via select and I tried to make it non-blocking before writing, but nothing worked. The function simply freezes (i.e. no return, even as a non-blocking socket), probably because the socket thinks that it is ready, even though it really isn't. Is there any function out there that can reliably tell me whether or not I can call SSL_write in this scenario?

And if there isn't any way to do this, because I made some noobish mistake nobody who knows the first thing about OpenSSL should make:
What is the proper way of dealing with this scenario?

I simply have a scenario where both client and server can send messages at any time and the client can disconnect at any time. The latter is especially bad if it happens via network problems, because a user-invoked disconnect can be worked-around, e.g. the client tells the server "I'm going to disconnect soon, don't call SSL_write any more" and then it waits until the server is ready for disconnecting.

Kind regards

More information about the openssl-users mailing list