[mono-android] Random exceptions while reading SSL stream

Piotr Kryger piotr.kryger at gmail.com
Thu Nov 17 04:24:28 EST 2011


Hi,

Im trying to read binary data from ssl stream.
Basically, I do this:

Stream inner = ConnectToMyHttpsServerAndGetStream();
SslStream sslStream = new SslStream(inner, false, null, null);
sslStream.AuthenticateAsClient(certificateServerName);
BinaryReader reader = new BinaryReader(sslStream);
//calls to reader methods go here
reader.Close();


Most of the time, code runs fine, but sometimes during reading
operations my app freezes. Log shows following (or similar)
stacktrace:
11-17 09:28:20.084 I/mono    (24066): Stacktrace:
11-17 09:28:20.084 I/mono    (24066):
11-17 09:28:20.084 I/mono    (24066):   at
Mono.Security.Protocol.Tls.CipherSuite.DecryptRecord
(byte[],byte[]&,byte[]&) <0x000e3>
11-17 09:28:20.125 I/mono    (24066):   at
Mono.Security.Protocol.Tls.RecordProtocol.decryptRecordFragment
(Mono.Security.Protocol.Tls.ContentType,byte[]) <0x0006b>
11-17 09:28:20.125 I/mono    (24066):   at
Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback
(System.IAsyncResult) <0x001b7>
11-17 09:28:20.125 I/mono    (24066):   at System.IO.Stream.BeginRead
(byte[],int,int,System.AsyncCallback,object) <0x00117>
11-17 09:28:20.125 I/mono    (24066):   at
Mono.Security.Protocol.Tls.RecordProtocol.BeginReceiveRecord
(System.IO.Stream,System.AsyncCallback,object) <0x0016f>
11-17 09:28:20.125 I/mono    (24066):   at
Mono.Security.Protocol.Tls.RecordProtocol.ReceiveRecord
(System.IO.Stream) <0x00023>
11-17 09:28:20.125 I/mono    (24066):   at
Mono.Security.Protocol.Tls.SslStreamBase.InternalReadCallback
(System.IAsyncResult) <0x002a3>
11-17 09:28:20.125 I/mono    (24066):   at (wrapper runtime-invoke)
<Module>.runtime_invoke_void__this___object
(object,intptr,intptr,intptr) <0xffffffff>

The more data is read, the more frequent the exception tends to be.
Is there anything I can do to workaround this issue? Or maybe Im doing
something wrong?
Im using M4A 1.2 and VS2010.

Thanks,
Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodroid/attachments/20111117/248f2ffc/attachment.html 


More information about the Monodroid mailing list