[Mono-dev] Question about NetworkStream.BeginRead

pablosantosluac at terra.es pablosantosluac at terra.es
Fri Mar 16 18:03:34 UTC 2012


Ok: the problem is that I was wrapping the NetworkStream with a
BufferedStream, and BufferedStream is not async in Mono, while it is
async in .NET

:(



On 16/03/2012 16:57, pablosantosluac at terra.es wrote:
> Hi,
> 
> I'm working on some changes to make the TcpChannel work in async mode.
> 
> Instead of changing all the reads and writes to async, I'm just
> modifying the intial message status read to async, so instead of having
> a pile of threads waiting for IO on the server (waiting for clients to
> call or disconnect), there will be only as few threads as running methods.
> 
> It works great on Windows even under huge load (I'm testing on a
> 100-nodes cluster on EC2).
> 
> But, now, trying on Linux simply fails because this call:
> 
> networkStream.BeginRead(buffer, 0, 6, callback, null);
> 
> where networkStream is System.Net.Sockets.NetworkStream
> 
> locks.
> 
> What it actually does is to block and then invoke the callback, but it
> doesn't go through until the callback finishes, which I think is not the
> desired behavior.
> 
> I'm running:
> Mono JIT compiler version 2.10.2 (tarball Mon Apr 18 15:12:52 UTC 2011)
> Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
>     TLS:           __thread
>     SIGSEGV:       altstack
>     Notifications: epoll
>     Architecture:  amd64
>     Disabled:      none
>     Misc:          debugger softdebug
>     LLVM:          yes(2.9svn-mono)
>     GC:            Included Boehm (with typed GC and Parallel Mark)
> 
> It fails with older monos too.
> 
> Obviously I'm doing something wrong.
> 
> Is there a way I can fix it?
> 
> Thanks,
> 
> pablo
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 


More information about the Mono-devel-list mailing list