[Mono-dev] Problem in Mono's implementation of System.IO.StreamReader?
Thiago Padilha
tpadilha84 at gmail.com
Thu Jul 8 15:22:40 EDT 2010
Hi,
I'm using StreamReader to read some text from a network stream that
will contain a two part message : the first part(the one I'm reading)
contains some headers in plain text, the second part may contain any
kind of data.
It doesnt matter the data in the second part of the message, I
intend to pass the underlying Stream to another code that will
correctly deserialize it. The problem is that the StreamReader decodes
a lot of text on my first call to ReadLine() (much more than one
line). The result is that the NetworkStream advances more than it
should, and I cant deserialize the second part of the message.
Is this intended behavior? I can easily work arround this by
buffering the second part of the message and wrapping a MemoryStream
arround it, but I'd rather pass the NetworkStream directly.
Also, sometimes I intend to close the network connection and discard
the second part depending on the headers I find.(And since the reader
will already have buffered it, the data will have to wait for garbage
collection).
Thanks.
More information about the Mono-devel-list
mailing list