[Mono-list] SslClientStream.StartRead don't return
Sebastien Pouliot
sebastien.pouliot at gmail.com
Mon Aug 1 13:55:48 EDT 2005
Hello Dominik,
On Mon, 2005-01-08 at 04:05 +0200, Dominik Zabłotny wrote:
> I am using SslClientStream to connect to jabber server. Both Read() and
> StartRead() functions work good, except that StartRead() doesn't return
> after starting async operation. Is it supposed to work this way or am I
> doing something wrong?
This may be due to the fact that the current negotiation code isn't
async.
This isn't a problem in most case because an SSL session generally
starts with a write operation from the client (e.g. GET from HTTPS) and
because this case was made safe.
However starting with an async read operation (e.g. BeginRead) may lock
because the negotiation requires both read/write operations to complete.
The simplest way to solve this is to do a write operation before
reading. IIRC doing this with a empty buffer (new byte [0]) should do
the trick (i.e. only do the negotiation from a safe point).
Then you should be able to read without problems... if not then please
open a new bug on bugzilla.ximian.com
> Simple program that shows the problem is attached, it compiles with:
> mcs -r:Mono.Security.dll -r:System.Security.dll Main.cs
Unless you're using XMLDSIG stuff you don't have to reference the
System.Security.dll assembly to make crypto/ssl work in your
applications (i.e. the namespaces you're using are part of
mscorlib.dll).
Sebastien
More information about the Mono-list
mailing list