[Mono-list] blocking calls Ssl client and server streams constructors

Sebastien Pouliot sebastien.pouliot at gmail.com
Thu Feb 16 22:35:10 EST 2006


On Thu, 2006-02-16 at 22:05 -0500, Arijit Ganguly wrote:
> Hello, 
> 
> I want to know if SslClientStream/SslServerStream constructors block
> until handshake for establishing a secure channel is on. I do not want
> my current thread to block on a socket, and therefore I plan to put
> the creation of client and server streams inside Begin/End Invoke.

IIRC the handshake occurs only on the first read or write operation, so
the ctor shouldn't block (at least not for that ;-)

> Does the same apply to SslStream::Close() too: is it a blocking call?

The best way to be sure is to look at the source code. However you
shouldn't depend on implementation details like that as they could
change in the future.

> Finally, I am listening on a number of secure sockets in a single
> thread. I use Select to handle multiple reads/writes in the same
> thread. 
> 
> The issue is in .NET we can only select sockets, and not streams. For
> secure channels, we can only read and write from streams. Is it okay
> if I Select on multiple sockets, and then do reads/writes on their
> associated SslClient or Server streams. 

The fact that the SSL code is stream based shouldn't be a problem as you
are supplying the underlying stream - which is (most likely) a
NetworkStream built with a Socket that you created.

-- 
Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/



More information about the Mono-list mailing list