Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Synchronous SslStream operations are not synchronous?

$
0
0

I'm now upgrading my project to work over SSL over TcpClient (we are using sockets to connect over TCP for chat).

I've got some troubles related to terminating the connection, but they are resolved (in some scenarios StreamReader.ReadLine() was blocked even after all the streams were disposed - that wasn't an issue before I started using SslStream over NetworkStream provided by TcpClient).

Meanwhile I noticed that SslStream is producing threads and in it's source code I found:

    public override int Read (byte[] buffer, int offset, int count)
    {
        return EndRead (BeginRead (buffer, offset, count, null, null));
    }

    public override void Write (byte[] buffer, int offset, int count)
    {
        EndWrite (BeginWrite (buffer, offset, count, null, null));
    }

(code from /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net.Security/SslStream.cs)

It's strange since finally it is using SslStreamBase where synchronous methods are seems to be implemented.

I don't need those async operations since the ThreadPool takes time to warm up and I prefer to perform some cycles for reading and writing in separate threads, but I can't figure out how to avoid this behavior not going deep into modifying the SslStream sources...

I have the following version: Xamarin.iOS Version: 7.0.7.2 (did not update to iOS 7.1).

Did someone face the problem? Maybe Xamarin developers will help?

Thank you!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>