[Mono-list] SslClientStream: nonblocking read?

Sebastien Pouliot spouliot@videotron.ca
Thu, 02 Dec 2004 09:15:11 -0500


Hello Hein,

> I would like to read >= 1 byte from a SSL client connection without
> blocking unnecessarily. I.e., if the input buffer is empty, receive
> one SSL record, otherwise just return what's in the input buffer.

I think this is already the case. The only "blocking" part is when the
session is initialized between the client and server.
Maybe Carlos could add more detailled informations...

> I don't see how to do this with the current API... any advice would be
> appreciated.

The current approach is stream based - so that's not an API problem. However
SSL/TLS is a record based protocol - it's not possible to (safely) return
data from partially received records (e.g. decryption is also done by
blocks - for most ciphers anyway, integrity is also checked in blocks).

> The reason I am interested in this is for an application like
> telnet-ssl / stunnel.

The record-based nature of SSL may not be a good choice (performance wise)
for such a project (i.e. lots of small packets). For this approach to work
"somewhat well" you'll need a server that break it's data in very small
records when required (e.g. time based).

Sebastien Pouliot
home: spouliot@videotron.ca
blog: http://pages.infinit.net/ctech/poupou.html