[Mono-dev] Question about NetworkStream.BeginRead

pablosantosluac at terra.es pablosantosluac at terra.es
Fri Mar 16 15:57:37 UTC 2012


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


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?



More information about the Mono-devel-list mailing list