Use SSL in multiple connections

Matt Caswell matt at openssl.org
Wed May 11 09:42:33 UTC 2022



On 11/05/2022 10:05, Souheila Hechaichi wrote:
> With my actual configuration, an SSL client established more connections 
> with the SSL server. Each process (server or client) creates only one 
> thread for Its sockets,  I observe a strange behavior. Some server 
> sockets remain blocked on the call of SSL_write even if they are in mode 
> non-blocking.

That is very strange.

> Side client some sockets loop indefinitely on the call of 
> SSL_read that return SSL_ERROR_WANT_READ.
> 
> Hence my question:
> 
> Is It mandatory to create a thread by connection, or can only one thread 
> be used by all the connections?
> 

Either model is acceptable. You can have a single thread managing all of 
your SSL objects, or one thread per SSL object. The main rule is that an 
individual SSL object is not thread-safe, so you cannot share a single 
SSL object between multiple threads without additional locking.

Matt


> Best regards;
> 


More information about the openssl-users mailing list